We do what we must because we can.
The algorithms:
- have descriptive names to ease reading code that performs bit manipulations,
- often optimize to perfect assembly code (and always on nightly by using the bitintr crate),
- works on
stableunstable only :( due to specialization for now.
extern crate bitwise;
use bitwise::word::*;
fn main() {
let u = outer_perfect_shuffle(0b_1001_1111u8);
let v = inner_perfect_shuffle(0b_1001_1111u8);
let w = u.copy_bit(4u8, v, 3u8);
assert_eq!(w.parallel_bits_deposit(u), 0b_1001_0011u8);
}
The minimum required rustc version is >= 1.13.0.
Requires unstable for now.
Some algorithms like the Morton Z-Curve encoding/decoding routines switch implementation at compile-time depending on target features (like BMI2 support).
Licensed under the MIT license.
The giants that came before us:
- Matthew Fioravante's N3864 A constexpr bitwise operations library for C++ proposal and accompanying library: stdcxx-bitops.
- Henry S. Warren's Hacker's Delight.
- Jeroen Baert's libmorton.
- The Chess Programming Wiki, in particular the bit-twiddling section.
- Real-Time Collision Detection.
- My own's bitintr library.
- Jasper Neumann's programming pages.
- Jörg Arndt's Matters Computational: Ideas, Algorithms, Source Code.
Yes please! Just note that all contributions shall be licensed as above without any additional terms or conditions. The following people have contributed code to this library:
- Gonzalo Brito Gadeschi (main author).
- Brian L. Troutwine.