Crates.io | bitmath_macros |
lib.rs | bitmath_macros |
version | 0.0.1 |
source | src |
created_at | 2022-04-21 02:32:06.463176 |
updated_at | 2022-04-21 02:32:06.463176 |
description | Utility proc macros for the bitmath crate |
homepage | |
repository | https://github.com/trashbyte/bitmath_macros |
max_upload_size | |
id | 571321 |
size | 4,589 |
Contains the utility proc macro bitslice!
used with the bitmath
crate.
Allows for taking subsets of Bits
objects as a new Bits
, with conventional bitwise syntax (e.g. 15:8 instead of 8..16)
let source = Bits::<16>::try_from("00001101 10110000").unwrap();
let middle_bits = bitslice!(source[12:4]);
println!("{}", middle_bits);
// Bits<8>{ 1101 1011 | dec 219/-37 | hex 0xdb/-0x25 }