#[inline(always)]
pub(crate) const fn likely(x: bool) -> bool {
#[cfg(feature = "nightly")] {
core::hint::likely(x)
}
#[cfg(not(feature = "nightly"))] {
if !x {
cold_path();
}
x
}
}
#[inline(always)]
pub(crate) const fn unlikely(x: bool) -> bool {
#[cfg(feature = "nightly")] {
core::hint::unlikely(x)
}
#[cfg(not(feature = "nightly"))] {
if x {
cold_path();
}
x
}
}
#[allow(dead_code)]
#[cold]
#[inline(always)]
const fn cold_path() {}
#[cfg_attr(not(docsrs), rustversion::since(1.81))]
#[inline(always)]
pub(crate) const unsafe fn assume(cond: bool) {
debug_assert!(cond);
core::hint::assert_unchecked(cond);
}
#[cfg_attr(not(docsrs), rustversion::before(1.81))]
#[cfg_attr(docsrs, cfg(not(docsrs)))]
#[inline(always)]
pub(crate) const unsafe fn assume(cond: bool) {
debug_assert!(cond);
}