Skip to content

Commit 1d0b293

Browse files
committed
Simplify type check
This is a bit more succinct and gets to the core point. Namely `arr.dtype` determines this code path. Also comparing directly to `bool` works here. It is a bit faster as well since we need not construct an `np.dtype` object.
1 parent bee6553 commit 1d0b293

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

numcodecs/delta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def encode(self, buf):
6464

6565
# compute differences
6666
# using np.subtract for in-place operations
67-
if self.dtype == np.dtype("bool"):
67+
if arr.dtype == bool:
6868
np.not_equal(arr[1:], arr[0:-1], out=enc[1:])
6969
else:
7070
np.subtract(arr[1:], arr[0:-1], out=enc[1:])

0 commit comments

Comments
 (0)