diff options
| author | Sean McArthur <sean.monstar@gmail.com> | 2016-08-31 16:02:55 -0700 |
|---|---|---|
| committer | Sean McArthur <sean.monstar@gmail.com> | 2016-09-02 10:29:32 -0700 |
| commit | b778f7fa0192ac6863f3ce0ab49d9c4001bf5503 (patch) | |
| tree | e462c72b1ce54a3f5e08e2fcb17b47f7d6216b48 /src/libcore | |
| parent | 824000aee3b9fd594a3da3eb38462fa341f0fa81 (diff) | |
| download | rust-b778f7fa0192ac6863f3ce0ab49d9c4001bf5503.tar.gz rust-b778f7fa0192ac6863f3ce0ab49d9c4001bf5503.zip | |
core: add likely and unlikely intrinsics
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 8271b85b01a..619656f4d71 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -194,6 +194,20 @@ extern "rust-intrinsic" { /// own, or if it does not enable any significant optimizations. pub fn assume(b: bool); + #[cfg(not(stage0))] + /// Hints to the compiler that branch condition is likely to be true. + /// Returns the value passed to it. + /// + /// Any use other than with `if` statements will probably not have an effect. + pub fn likely(b: bool) -> bool; + + #[cfg(not(stage0))] + /// Hints to the compiler that branch condition is likely to be false. + /// Returns the value passed to it. + /// + /// Any use other than with `if` statements will probably not have an effect. + pub fn unlikely(b: bool) -> bool; + /// Executes a breakpoint trap, for inspection by a debugger. pub fn breakpoint(); |
