[][src]Function safe_arch::bit_lowest_set_value_u64

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

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

If the input is 0 you get 0 back.

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