[][src]Function safe_arch::bit_lowest_set_value_u32

#[must_use]pub fn bit_lowest_set_value_u32(a: u32) -> u32
This is supported with target feature bmi1 only.

Gets the value of the lowest set bit in a u32.

If the input is 0 you get 0 back.

  • Formula: (!a) & a
assert_eq!(bit_lowest_set_value_u32(0b0), 0);
assert_eq!(bit_lowest_set_value_u32(0b1), 1);
assert_eq!(bit_lowest_set_value_u32(0b10), 2);
assert_eq!(bit_lowest_set_value_u32(0b100), 4);
assert_eq!(bit_lowest_set_value_u32(0b111100), 4);