hibitset
hibitset copied to clipboard
Add u128 support
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
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.
The
MAX_EIDis:const MAX_EID: u32 = (2 << (Self::LOG_BITS * LAYERS) - 1) as u32;so for u128 that is
2 ^ (7 * 4) = 268435456I haven't looked into how the
MAX_EIDformula 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.