Skip to content

Commit 0636c75

Browse files
committed
cast filebytes to int/int64
NPY_PROMOTION_STATE=weak_and_warn reports that several variables changed from int64 to uint8.
1 parent 56b7d5c commit 0636c75

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wfdb/io/annotation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,7 +2219,7 @@ def proc_core_fields(filebytes, bpi):
22192219

22202220
# The current byte pair will contain either the actual d_sample + annotation store value,
22212221
# or 0 + SKIP.
2222-
while filebytes[bpi, 1] >> 2 == 59:
2222+
while int(filebytes[bpi, 1]) >> 2 == 59:
22232223
# 4 bytes storing dt
22242224
skip_diff = (
22252225
(int(filebytes[bpi + 1, 0]) << 16)
@@ -2237,7 +2237,9 @@ def proc_core_fields(filebytes, bpi):
22372237

22382238
# Not a skip - it is the actual sample number + annotation type store value
22392239
label_store = filebytes[bpi, 1] >> 2
2240-
sample_diff += int(filebytes[bpi, 0] + 256 * (filebytes[bpi, 1] & 3))
2240+
sample_diff += np.int64(filebytes[bpi, 0]) + 256 * np.int64(
2241+
filebytes[bpi, 1] & 3
2242+
)
22412243
bpi = bpi + 1
22422244

22432245
return sample_diff, label_store, bpi

0 commit comments

Comments
 (0)