Skip to content

Conversation

dcapwell
Copy link
Contributor

@dcapwell dcapwell commented Sep 8, 2025

No description provided.

private int nextSetBitInternal(int i, int exclIndexBound, int ifNotFound)
{
Invariants.requireArgument(i >= 0);
Invariants.requireArgument(i <= size());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the interface doesn't expose a way to know the size, so you need to rely on nextSetBitInternal to know when to complete iterating, so rather than failing return -1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern here is that this is inconsistent with get/set etc. We should either consistently change all of these methods to support indexes outside of the range, or we should retain the existing behaviour and simply expose capacity() in the interface. I don't have a strong opinion, though I lean towards the capacity() approach as it is is more likely than not to be a bug to access outside of the allocated range.

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