Skip to main content

read_bit

Function read_bit 

Source
pub fn read_bit(byte: u8, n: u8) -> bool
Expand description

Read bit n from a byte. Returns true if the bit is set.

Bits are numbered LSB-first: bit 0 is 0x01, bit 7 is 0x80.

let is_locked = read_bit(flags, 0);
let is_frozen = read_bit(flags, 1);