petgraph / fixedbitset

A simple bitset container for Rust
https://docs.rs/fixedbitset/
Apache License 2.0
124 stars 47 forks source link

count_ones broken for capacity=512 #12

Closed BenWiederhake closed 7 years ago

BenWiederhake commented 7 years ago

Minimal reproducing example (runnable version):

let v = fixedbitset::FixedBitSet::with_capacity(512usize);
println!("{}", v.count_ones(..));

Expected behavior: Print 0 Actual behavior: panic:

~/workspace/mincounter_fixedbitset$ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/mincounter_fixedbitset`
thread 'main' panicked at 'index out of bounds: the len is 16 but the index is 16', /checkout/src/libcollections/vec.rs:1401
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: <collections::vec::Vec<T> as core::ops::Index<usize>>::index
             at /checkout/src/libcollections/vec.rs:1401
   1: fixedbitset::FixedBitSet::count_ones
             at .../.cargo/registry/src/github.com-1ecc6299db9ec823/fixedbitset-0.1.5/src/lib.rs:168

As far as I can see, I already use the newest version.

BenWiederhake commented 7 years ago

Eerily fast. Awesome, thank you!

bluss commented 7 years ago

There's a bit of backlog with this crate, some unresolved PRs