[go: up one dir, main page]

time 0.3.44

Date and time library. Fully interoperable with the standard library. Mostly compatible with #![no_std].
Documentation
//! Hints to the compiler that affects how code should be emitted or optimized.

/// Indicate that a given branch is **not** likely to be taken, relatively speaking.
#[inline(always)]
#[cold]
pub(crate) const fn cold_path() {}

/// Indicate that a given condition is likely to be true.
#[inline(always)]
pub(crate) const fn likely(b: bool) -> bool {
    if !b {
        cold_path();
    }
    b
}

/// Indicate that a given condition is likely to be false.
#[inline(always)]
pub(crate) const fn unlikely(b: bool) -> bool {
    if b {
        cold_path();
    }
    b
}