Skip to content

Commit

Permalink
explicit casting for int overflow logic (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjonesolmedo authored Oct 25, 2024
1 parent 93d86af commit 4a156cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pysierraecg/src/sierraecg/xli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ def xli_unpack(buffer: List[int]) -> npt.NDArray[np.int16]:
[0 for _ in range(int(len(buffer) / 2))], dtype=np.int16
)
for i in range(len(unpacked)):
unpacked[i] = (((buffer[i] << 8) | buffer[len(unpacked) + i]) << 16) >> 16
joined_bytes = (((buffer[i] << 8) | buffer[len(unpacked) + i]) << 16) >> 16
unpacked[i] = np.array(joined_bytes).astype(np.int16)
return unpacked

0 comments on commit 4a156cc

Please sign in to comment.