Skip to content

Commit d677fd4

Browse files
committed
Remove backup implementation of likely/unlikely that didn't work
1 parent 4d8c059 commit d677fd4

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

src/raw/mod.rs

+4-24
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,12 @@ use self::imp::Group;
4444

4545
// Branch prediction hint. This is currently only available on nightly but it
4646
// consistently improves performance by 10-15%.
47-
#[cfg(feature = "nightly")]
48-
use core::intrinsics::{likely, unlikely};
49-
50-
// On stable we can use #[cold] to get a equivalent effect: this attributes
51-
// suggests that the function is unlikely to be called
5247
#[cfg(not(feature = "nightly"))]
53-
#[inline]
54-
#[cold]
55-
fn cold() {}
56-
57-
#[cfg(not(feature = "nightly"))]
58-
#[inline]
59-
fn likely(b: bool) -> bool {
60-
if !b {
61-
cold();
62-
}
63-
b
64-
}
48+
use core::convert::identity as likely;
6549
#[cfg(not(feature = "nightly"))]
66-
#[inline]
67-
fn unlikely(b: bool) -> bool {
68-
if b {
69-
cold();
70-
}
71-
b
72-
}
50+
use core::convert::identity as unlikely;
51+
#[cfg(feature = "nightly")]
52+
use core::intrinsics::{likely, unlikely};
7353

7454
// Use strict provenance functions if available.
7555
#[cfg(feature = "nightly")]

0 commit comments

Comments
 (0)