Skip to content

Change usize to u64 for all variables that aren't indices into byte-based structures #34

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

Open
wants to merge 20 commits into
base: dev_2.0
Choose a base branch
from

Conversation

Cydhra
Copy link
Owner

@Cydhra Cydhra commented Jun 28, 2025

Bit vectors can hold more bits than usize::MAX, and therefore all bit-indexing and length calculation should be performed with u64 instead.

This has some unfortunate side effects that need to be addressed

  • ExactSizeIterator does not support iterators with more than usize::MAX elements. Code paths where this can be circumvented should be special-cased for <64 bit plattforms, and where it can't there should be documentation about potential panics.
  • take() and skip() in iterators takes a usize, which means subtrees in BP that exceed 2^32 bits cannot be handled properly.
  • When converting from u64 to usize for indexing byte-based structures, care must be taken that conversions happen in the correct order

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 Milestones for 2.0 Release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant