Skip to content

Commit 4cc709c

Browse files
committed
Remove math.ceil in favor of integer division (//)
1 parent d4c2206 commit 4cc709c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/blosc2/ndarray.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,13 +1073,12 @@ def detect_aligned_chunks( # noqa: C901
10731073
for i, s in enumerate(key):
10741074
start = s.start if s.start is not None else 0
10751075
stop = s.stop if s.stop is not None else shape[i]
1076-
10771076
chunk_size = chunks[i]
10781077
start_idx = start // chunk_size
1079-
end_idx = math.ceil(stop / chunk_size)
1078+
end_idx = stop // chunk_size
10801079
start_indices.append(start_idx)
10811080
end_indices.append(end_idx)
1082-
n_chunks.append(math.ceil(shape[i] / chunk_size))
1081+
n_chunks.append(shape[i] // chunk_size)
10831082

10841083
# Get all chunk combinations in the slice
10851084
indices = [range(start, end) for start, end in zip(start_indices, end_indices, strict=False)]
@@ -1091,7 +1090,6 @@ def detect_aligned_chunks( # noqa: C901
10911090
for idx, n in zip(reversed(range(len(n_chunks))), reversed(n_chunks), strict=False):
10921091
flat_index += combination[idx] * multiplier
10931092
multiplier *= n
1094-
10951093
result.append(flat_index)
10961094

10971095
# Check if chunks are consecutive if requested

0 commit comments

Comments
 (0)