[−][src]Function safe_arch::bit_lowest_set_reset_u64
#[must_use]pub fn bit_lowest_set_reset_u64(a: u64) -> u64
This is supported with target feature
bmi1
only.Resets (clears) the lowest set bit.
If the input is 0 you get 0 back.
- Formula:
(a - 1) & a
assert_eq!(bit_lowest_set_reset_u64(0b0), 0); assert_eq!(bit_lowest_set_reset_u64(0b1), 0b0); assert_eq!(bit_lowest_set_reset_u64(0b10), 0b00); assert_eq!(bit_lowest_set_reset_u64(0b100), 0b000); assert_eq!(bit_lowest_set_reset_u64(0b111100), 0b111000);