rust_ofp 0.2.1

Rust OpenFlow 0x01 Protocol and Controller Framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
/// Set bit `bit` of `x` on if `toggle` is true, otherwise off.
pub fn bit(bit: u64, x: u64, toggle: bool) -> u64 {
    if toggle {
        x | (1 << bit)
    } else {
        x & !(1 << bit)
    }
}

/// Test whether bit `bit` of `x` is set.
pub fn test_bit(bit: u64, x: u64) -> bool {
    (x >> bit) & 1 == 1
}