| // FIXME: Replace with `core::hint::{likely, unlikely}` once they are stable. | |
| #[cfg(feature = "nightly")] | |
| pub(crate) use core::intrinsics::{likely, unlikely}; | |
| #[cfg(not(feature = "nightly"))] | |
| #[inline(always)] | |
| #[cold] | |
| fn cold_path() {} | |
| #[cfg(not(feature = "nightly"))] | |
| #[inline(always)] | |
| pub(crate) fn likely(b: bool) -> bool { | |
| if b { | |
| true | |
| } else { | |
| cold_path(); | |
| false | |
| } | |
| } | |
| #[cfg(not(feature = "nightly"))] | |
| #[inline(always)] | |
| pub(crate) fn unlikely(b: bool) -> bool { | |
| if b { | |
| cold_path(); | |
| true | |
| } else { | |
| false | |
| } | |
| } |