Skip to main content

classicube_sys/
math.rs

1use crate::std_types::c_int;
2
3#[must_use]
4pub fn Math_NextPowOf2(value: c_int) -> c_int {
5    let mut next = 1;
6    while value > next {
7        next <<= 1;
8    }
9    next
10}
11
12#[must_use]
13pub fn Math_IsPowOf2(value: c_int) -> bool {
14    value != 0 && (value & (value - 1)) == 0
15}