# utils.rs - source
Source of the Rust file `/home/runner/.cargo/git/checkouts/k210-soc-513b01293da09fa1/09a0742/src/utils.rs`.
Keywords: rust, rustlang, rust-lang

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    #![allow(unused)]

    //! Miscelleneous utilities for SoC functions (private)

    pub fn set_bit(inval: u32, bit: u8, state: bool) -> u32 {
        if state {
            inval | (1 << u32::from(bit))
        } else {
            inval & !(1 << u32::from(bit))
        }
    }

    pub fn get_bit(inval: u32, bit: u8) -> bool {
        (inval & (1 << u32::from(bit))) != 0
    }