clear_bit

Function clear_bit 

Source
pub const fn clear_bit(base: u32, bit: u32) -> u32
Expand description

Clears the given bit by setting it to 0.

The bit position starts at 0.

§Parameters

  • base: Base value to alter.
  • bit: Bit to clear, starting at position 0.

§Example

use bit_ops::bitops_u32::clear_bit;

let raw = clear_bit(0b1000_0000, 7);
assert_eq!(raw, 0);

§Panics

This function panics for bit positions that are outside the range of the underlying type.