diff --git a/numcodecs/bitround.py b/numcodecs/bitround.py index 29f46bf8..dc8d5116 100644 --- a/numcodecs/bitround.py +++ b/numcodecs/bitround.py @@ -59,7 +59,8 @@ def encode(self, buf): return a if self.keepbits > bits: raise ValueError("Keepbits too large for given dtype") - b = a.view(a_int_dtype) + b = a.copy() + b = b.view(a_int_dtype) maskbits = bits - self.keepbits mask = (all_set >> maskbits) << maskbits half_quantum1 = (1 << (maskbits - 1)) - 1