Skip to content

Commit

Permalink
Speed up range check
Browse files Browse the repository at this point in the history
  • Loading branch information
trossi committed Sep 16, 2024
1 parent d450f73 commit 4d3e38f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rdata/unparser/_unparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _unparse_array_values(self, array: npt.NDArray[Any]) -> None:

if array.dtype != np.int32:
info = np.iinfo(np.int32)
if np.any((array < info.min) | (array > info.max)):
if np.any(array > info.max) or np.any(array < info.min):
msg = "Integer array not castable to int32"
raise ValueError(msg)
array = array.astype(np.int32)
Expand Down

0 comments on commit 4d3e38f

Please # to comment.