bit_slice

Macro bit_slice 

Source
macro_rules! bit_slice {
    ($n:expr, $i:expr) => { ... };
    ($n:expr, $msb:expr, $lsb:expr) => { ... };
}
Expand description

Macro to help with bit level access to integers. Example attempts to mimic Verilog syntax.

Example:

bit_slice!(0b1101, 3, 2) == 0b11;
bit_slice!(0b1101, 1) == 0b0;