From 16ec15d474c106d89d60fdb270a9d9ff39efddcf Mon Sep 17 00:00:00 2001 From: ray3242 Date: Sun, 22 Nov 2026 20:43:52 -0600 Subject: [PATCH] docs: state the slice contract in zero_span's docstring --- tools/zero_span.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/zero_span.py b/tools/zero_span.py index cd49908cb..0df7d5b25 100644 --- a/tools/zero_span.py +++ b/tools/zero_span.py @@ -5,6 +5,10 @@ padding only when every byte in it is zero. Slicing an mmap copies the slice, so whole gap at once. On a large archive a gap can run to gigabytes (story000.rpf, about 20 GB, cannot be indexed on a 16 GB machine that way), so the gap is compared against zeros one window at a time instead, and the first non-zero window ends the check. + +The range is normalized with Python's own slice rules, so the counts and verdicts match `buf[start:end]` for +negative and out-of-range endpoints. That is the right contract here because callers address the buffer through +slices rather than raw file offsets. """ WINDOW = 1 << 22 # 4 MiB: the most a check allocates, besides the shared zero block