Files
rust/tests/source/cfg_if/detect/bit.rs
T
2019-06-08 18:47:18 +09:00

10 lines
222 B
Rust

//! Bit manipulation utilities.
/// Tests the `bit` of `x`.
#[allow(dead_code)]
#[inline]
pub(crate) fn test(x: usize, bit: u32) -> bool {
debug_assert!(bit < 32, "bit index out-of-bounds");
x & (1 << bit) != 0
}