Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roaring64 iterator cannot come back from the edge #574

Closed
Dr-Emann opened this issue Jan 26, 2024 · 0 comments · Fixed by #578
Closed

Roaring64 iterator cannot come back from the edge #574

Dr-Emann opened this issue Jan 26, 2024 · 0 comments · Fixed by #578
Assignees

Comments

@Dr-Emann
Copy link
Member

Something like this should work

roaring64_bitmap_t *b = roaring64_bitmap_of(1, 100ULL);
roaring64_iterator_t *it = roaring64_iterator_create(b);
// it points at the first item, 100

roaring64_iterator_previous(it);
// it now points before the first item

roaring64_iterator_advance(it);
assert(roaring64_iterator_has_value(it));
assert(roaring64_iterator_value(it) == 100);

But instead it fails, right at the beginning of roaring64_iterator_advance:

if (it->art_it.value == NULL) {
    return (it->has_value = false);
}

In fact, because of this check, it seems like it should be safe to call roaring64_iterator_advance repeatedly even after reaching the end of the bitmap.

Originally posted by @Dr-Emann in #558 (comment)

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 a pull request may close this issue.

2 participants