Skip to content

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