Crates.io | bit_fiddler |
lib.rs | bit_fiddler |
version | 2.1.1 |
source | src |
created_at | 2020-11-17 16:31:30.992717 |
updated_at | 2020-11-21 02:04:08.196914 |
description | Macros for common bit operations with multiple convenient patterns |
homepage | |
repository | https://github.com/MihirLuthra/bit_fiddler |
max_upload_size | |
id | 313329 |
size | 54,358 |
Crate for common bit operations. Mainly for setting, toggling, unsetting and checking bits.
These operations are provided by macros which accept multiple patterns to allow easy bit fiddling. These include operations on a single bit, range of bits, etc. See macro docs for more details.
Macros in this crate don't do overflow/underflow checks. If invalid args are supplied, behaviour depends on the underlying operators and may panic.
use bit_fiddler::set;
let mut bitmap = 0b_0000_0000;
set!(in bitmap, u8, [3..6]);
assert_eq!(bitmap, 0b_0011_1000);
Documentation is available on https://docs.rs/bit_fiddler