2021-11-30 14:30:13 +00:00
|
|
|
#[inline(always)]
|
2021-12-30 10:21:54 +00:00
|
|
|
#[cold]
|
|
|
|
pub const fn cold() {}
|
|
|
|
|
|
|
|
#[inline(always)]
|
2021-12-30 22:44:59 +00:00
|
|
|
#[allow(unused)]
|
2021-11-30 14:30:13 +00:00
|
|
|
pub const fn likely(b: bool) -> bool {
|
2021-12-30 10:21:54 +00:00
|
|
|
if !b {
|
2021-12-31 10:37:56 +00:00
|
|
|
cold();
|
2021-11-30 14:30:13 +00:00
|
|
|
}
|
2021-12-30 10:21:54 +00:00
|
|
|
b
|
2021-11-30 14:30:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline(always)]
|
|
|
|
pub const fn unlikely(b: bool) -> bool {
|
2021-12-30 10:21:54 +00:00
|
|
|
if b {
|
2021-12-31 10:37:56 +00:00
|
|
|
cold();
|
2021-11-30 14:30:13 +00:00
|
|
|
}
|
2021-12-30 10:21:54 +00:00
|
|
|
b
|
2021-11-30 14:30:13 +00:00
|
|
|
}
|