File tree 1 file changed +4
-24
lines changed
1 file changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -44,32 +44,12 @@ use self::imp::Group;
44
44
45
45
// Branch prediction hint. This is currently only available on nightly but it
46
46
// 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
52
47
#[ 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;
65
49
#[ 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} ;
73
53
74
54
// Use strict provenance functions if available.
75
55
#[ cfg( feature = "nightly" ) ]
You can’t perform that action at this time.
0 commit comments