| 1 | //! Hints to the compiler that affects how code should be emitted or optimized. |
| 2 | |
| 3 | /// Indicate that a given branch is **not** likely to be taken, relatively speaking. |
| 4 | #[inline(always)] |
| 5 | #[cold] |
| 6 | pub(craterust-analyzer cargo time 0.3.47 crate/) const fn cold_pathrust-analyzer cargo time 0.3.47 hint/cold_path().() {} |
| 7 | |
| 8 | /// Indicate that a given condition is likely to be true. |
| 9 | #[inline(always)] |
| 10 | pub(craterust-analyzer cargo time 0.3.47 crate/) const fn likelyrust-analyzer cargo time 0.3.47 hint/likely().(b: bool) -> bool { |
| 11 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().b { |
| 12 | cold_pathrust-analyzer cargo time 0.3.47 hint/cold_path().(); |
| 13 | } |
| 14 | b |
| 15 | } |
| 16 | |
| 17 | /// Indicate that a given condition is likely to be false. |
| 18 | #[inline(always)] |
| 19 | pub(craterust-analyzer cargo time 0.3.47 crate/) const fn unlikelyrust-analyzer cargo time 0.3.47 hint/unlikely().(b: bool) -> bool { |
| 20 | if b { |
| 21 | cold_pathrust-analyzer cargo time 0.3.47 hint/cold_path().(); |
| 22 | } |
| 23 | b |
| 24 | } |