A small library for bit-twiddling.
You can use it as a dependency by adding it to your Cargo.toml
file.
toml
[dependencies]
twiddle = "*"
```rust extern crate twiddle;
use twiddle::Twiddle;
struct UnpackedF32 { negative: bool, exponent: i16, fraction: u32, }
impl From
fn main() { for f in (-5..6) { let u = UnpackedF32::from(f as f32); println!("{:+} = {}1.{:023b} * 2^{}", f, match u.negative { false => "+", true => "-" }, u.fraction, u.exponent ); } } ```