qoi/src/utils.rs

21 lines
265 B
Rust
Raw Normal View History

#[inline(always)]
2021-12-30 10:21:54 +00:00
#[cold]
pub const fn cold() {}
#[inline(always)]
#[allow(unused)]
pub const fn likely(b: bool) -> bool {
2021-12-30 10:21:54 +00:00
if !b {
cold()
}
2021-12-30 10:21:54 +00:00
b
}
#[inline(always)]
pub const fn unlikely(b: bool) -> bool {
2021-12-30 10:21:54 +00:00
if b {
cold()
}
2021-12-30 10:21:54 +00:00
b
}