macro_rules! bx {
($bytes:expr, $bits:expr) => { ... };
(, $bits:expr) => { ... };
($bytes:expr) => { ... };
}Expand description
Helper function for initializing BitIndex. Depending on arguments
provided, this can be used to initialize a BitIndex using the bytes,
bits, or both.
ยงExamples
use bitutils2::{BitIndex, bx};
// If two integers are provided, then they are interpreted as bytes, bits
assert_eq!(bx!(5, 4), BitIndex::new(5, 4));
// If one integer is provided, then it is interpreted as bytes
assert_eq!(bx!(5), BitIndex::new(5, 0));
// If one integer is provided after a comma, then it is interpreted as bits
assert_eq!(bx!(,20), BitIndex::new(2, 4));