3 releases
0.1.2 | May 13, 2024 |
---|---|
0.1.1 | May 13, 2024 |
0.1.0 | May 13, 2024 |
#557 in Algorithms
25KB
554 lines
rev_bits
A Rust library for reversing bits for a specified range of an integer (u32
or u64
).
Example
let x: u32 = 0xF0FFA000;
let y = reverse(x, 8..16);
println!("original: {:08X}", x);
println!(" changed: {}", "....xx..");
println!("reversed: {:08X}", y);
Gives:
original: F0FFA000
changed: ....xx..
reversed: F0FF0500
Crate
rev_bits
is available on crates.io:
cargo add rev_bits
Test
rev_bits
has extensive property-based tests thanks to QuickCheck:
cargo test
Benchmark
rev_bits
has benchmarks thanks to Criterion.rs:
cargo bench