We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd04292 commit 33e01eeCopy full SHA for 33e01ee
backend/classification/parser/sd_file.py
@@ -6,6 +6,9 @@
6
7
ROWS_TO_SKIP = 2
8
9
+SIGNED_BIT = int("800000", 16)
10
+SIGNED_BIT_2 = 2 * SIGNED_BIT
11
+
12
13
def _hexstr_to_int(hexstr):
14
"""Converts a two complement hexadecimal value in a string to a signed float
@@ -14,7 +17,8 @@ def _hexstr_to_int(hexstr):
17
Returns:
15
18
- decimal value
16
19
"""
- return int.from_bytes(bytes.fromhex(hexstr), byteorder='big', signed=True)
20
+ raw_int = int(hexstr, 16)
21
+ return raw_int - SIGNED_BIT_2 if raw_int >= SIGNED_BIT else raw_int
22
23
24
def parse_sd_file(file):
0 commit comments