lowest_bit

Function lowest_bit 

Source
pub const fn lowest_bit(base: u128) -> Option<u128>
Expand description

Returns the lowest bit that is set, if any.

The bit position starts at 0.

§Parameters

  • base: Base value to get lowest bit from.

§Example

use bit_ops::bitops_u128::lowest_bit;

assert_eq!(lowest_bit(0), None);
assert_eq!(lowest_bit(1), Some(0));
assert_eq!(lowest_bit(0b1011), Some(0));
assert_eq!(lowest_bit(0b1000), Some(3));