Crates.io | bitops |
lib.rs | bitops |
version | 0.1.0 |
source | src |
created_at | 2018-06-27 16:25:00.859746 |
updated_at | 2018-06-27 16:25:00.859746 |
description | Miscellaneous bit operations for any Integer. |
homepage | https://github.com/rossmacarthur/bitops |
repository | https://github.com/rossmacarthur/bitops |
max_upload_size | |
id | 71964 |
size | 17,774 |
Miscellaneous bit operations for any Integer. See documentation here.
Add to your project with
cargo add bitops
or directly editing your Cargo.toml
[dependencies]
bitops = "0.1.0"
use bitops::BitOps;
let x = 0b1010_1011_0000_1100; // 0xab0c
let flag = 0b1000;
assert!(flag.is_flag());
assert!(flag.is_bit_set(3));
assert!(x.is_flag_set(flag));
assert_eq!(x.bits_as_int(8, 4), 0xb);
Licensed under either of
at your option.