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

Add u128 support #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevefan1999-personal
Copy link

No description provided.

@stevefan1999-personal
Copy link
Author

stevefan1999-personal commented Oct 14, 2024

Huh, strange, why is it still not behaving like HashSet<u32>?

use hibitset::GenericBitSet;

fn main() {
    let mut set = GenericBitSet::<u128>::new();
    set.add(u32::MAX);
    println!("{set:?}");
}
thread 'main' panicked at F:\Git\github.com\stevefan1999-personal\hibitset\src\lib.rs:96:13:
Expected index to be less then 268435456, found 4294967295

@Imberflur
Copy link
Contributor

The MAX_EID is:

const MAX_EID: u32 = (2 << (Self::LOG_BITS * LAYERS) - 1) as u32;

so for u128 that is 2 ^ (7 * 4) = 268435456

I haven't looked into how the MAX_EID formula was derived, so can't offer further explanation.

@stevefan1999-personal
Copy link
Author

stevefan1999-personal commented Oct 15, 2024

The MAX_EID is:

const MAX_EID: u32 = (2 << (Self::LOG_BITS * LAYERS) - 1) as u32;

so for u128 that is 2 ^ (7 * 4) = 268435456

I haven't looked into how the MAX_EID formula was derived, so can't offer further explanation.

That's a pity since I cannot have more than 2^28 entities in the map, I guess its well enough for non-extreme situations.

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