Skip to content

Commit 0bf15f9

Browse files
authored
Merge pull request #35 from harp-tech/gl-dev
Avoid silent overflow for numpy compatibility
2 parents c90387e + 750bb53 commit 0bf15f9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

harp/io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def read(
8080
raise ValueError(f"expected address {address} but got {data[2]}")
8181

8282
index = None
83-
stride = data[1] + 2
83+
stride = int(data[1] + 2)
8484
nrows = len(data) // stride
8585
payloadtype = data[4]
8686
payloadoffset = 5
@@ -90,7 +90,7 @@ def read(
9090
micros = np.ndarray(nrows, dtype=np.uint16, buffer=data, offset=payloadoffset, strides=stride)
9191
payloadoffset += 2
9292
time = micros * _SECONDS_PER_TICK + seconds
93-
payloadtype = payloadtype & ~0x10
93+
payloadtype = payloadtype & ~np.uint8(0x10)
9494
if epoch is not None:
9595
time = epoch + pd.to_timedelta(time, "s") # type: ignore
9696
index = pd.Series(time)

0 commit comments

Comments
 (0)