Skip to content

Fix NextAbsentValue and PreviousAbsentValue - #579

Merged
lemire merged 2 commits into
masterfrom
fix-absent-values
Oct 27, 2026
Merged

lemire merged 2 commits into
masterfrom
fix-absent-values

Conversation

@lemire

@lemire lemire commented Oct 27, 2026

Copy link
Copy Markdown
Member

Description

Same fix as #578 for NextAbsentValue and PreviousAbsentValue, with the comments trimmed. Supersedes #578.

The behaviour change is Akron's commit. The follow-up only edits comments.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update
  • Test improvements

Changes Made

What was changed?

  • NextAbsentValue and PreviousAbsentValue, plus the array and bitmap container helpers, as in Fix NextAbsentValue and PreviousAbsentValue #578
  • Comments now state the two invariants: keyspace is already key<<16, and 1<<16 / -1 mean the container is exhausted
  • bitmapContainer.nextAbsentValue no longer says an out-of-range target returns -1

Why was it changed?

  • Those methods returned the wrong absent value. The cases are covered by the tests from Fix NextAbsentValue and PreviousAbsentValue #578.
  • The comments added with that fix retold the old safeMaximum / safeMinimum checks instead of the invariant.

How was it changed?

Testing

gofmt -w bitmapcontainer.go roaring.go arraycontainer_test.go bitmapcontainer_test.go roaring_test.go
go test

go test passed.

Formatting

gofmt reports no diff.

Fuzzing

Not run. The second commit does not change behaviour.

Performance Impact

None. No benchmarks cover these methods.

Breaking Changes

No, unless a caller depended on the old wrong results.

Related Issues

Supersedes #578.

Additional Notes

Please close #578 in favour of this branch.

Akron and others added 2 commits October 27, 2026 18:08
keyspace is already key<<16. 1<<16 and -1 mean the container is
exhausted. Drop the notes that retell the old safeMinimum and
safeMaximum checks, and correct nextAbsentValue's sentinel.
@lemire
lemire merged commit 0a801f7 into master Oct 27, 2026
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants