Skip to content

Commit b29dcb2

Browse files
committed
Fixes binary operation #201
Fixes incorrect addition of two binary number causing a TypeError from adding two incompatible types. Fixes #201.
1 parent bbd0903 commit b29dcb2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wfdb/io/annotation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,9 +1339,9 @@ def field2bytes(field, value):
13391339
# Just need samp and sym
13401340
else:
13411341
# - First byte stores low 8 bits of samp
1342-
# - Second byte stores high 2 bits of samp
1343-
# and sym
1344-
data_bytes = [sd & 255, ((sd & 768) >> 8) + 4*typecode]
1342+
# - Second byte stores high 2 bits of samp and sym
1343+
second_arg = bin(int(((sd & 768) >> 8),2) + int(4*typecode,2))
1344+
data_bytes = [sd & 255, second_arg]
13451345

13461346
elif field == 'num':
13471347
# First byte stores num

0 commit comments

Comments
 (0)