File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -603,8 +603,23 @@ extern "rust-intrinsic" {
603
603
/// cast to a `u64`; if `T` has no discriminant, returns 0.
604
604
pub fn discriminant_value < T > ( v : & T ) -> u64 ;
605
605
606
+ /// Hints to the compiler that a branch is likely to be taken. Returns the value
607
+ /// passed to it. In order for the hint to take effect, it should be used as follows:
608
+ ///
609
+ /// ```
610
+ /// unsafe fn foo(a: i32, b: i32) -> i32 {
611
+ /// if likely(a == b) {
612
+ /// 1
613
+ /// } else {
614
+ /// 2
615
+ /// }
616
+ /// }
617
+ /// ```
606
618
#[ cfg( not( stage0) ) ]
607
619
pub fn likely ( v : bool ) -> bool ;
620
+
621
+ /// Hints to the compiler that a branch is not likely to be taken. See `likely` for
622
+ /// more details
608
623
#[ cfg( not( stage0) ) ]
609
624
pub fn unlikely ( v : bool ) -> bool ;
610
625
}
You can’t perform that action at this time.
0 commit comments