Skip to content

Commit 560dee1

Browse files
committed
switch to copy
1 parent 5e78b5f commit 560dee1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

numcodecs/bitround.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ def encode(self, buf):
5959
return a
6060
if self.keepbits > bits:
6161
raise ValueError("Keepbits too large for given dtype")
62-
b = a.view(a_int_dtype)
62+
b = a.astype(a_int_dtype, copy=True)
6363
maskbits = bits - self.keepbits
6464
mask = (all_set >> maskbits) << maskbits
6565
half_quantum1 = (1 << (maskbits - 1)) - 1
66-
b = b + ((b >> maskbits) & 1) + half_quantum1
67-
b = b & mask
66+
b += ((b >> maskbits) & 1) + half_quantum1
67+
b &= mask
6868
return b
6969

7070
def decode(self, buf, out=None):

0 commit comments

Comments
 (0)