File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,10 @@ unsafe fn skip_search<const SOR: usize, const OFFSETS: usize>(
94
94
// correct location cannot be past it, so `Err(idx) => idx != length` either.
95
95
//
96
96
// This means that we can avoid bounds checking for the accesses below, too.
97
- unsafe { crate :: hint:: assert_unchecked ( last_idx < SOR ) } ;
97
+ //
98
+ // We need to use `intrinsics::assume` since the `panic_nounwind` contained
99
+ // in `hint::assert_unchecked` may not be optimized out.
100
+ unsafe { crate :: intrinsics:: assume ( last_idx < SOR ) } ;
98
101
99
102
let mut offset_idx = short_offset_runs[ last_idx] . start_index ( ) ;
100
103
let length = if let Some ( next) = short_offset_runs. get ( last_idx + 1 ) {
@@ -112,7 +115,10 @@ unsafe fn skip_search<const SOR: usize, const OFFSETS: usize>(
112
115
// SAFETY: It is guaranteed that `length <= OFFSETS - offset_idx`,
113
116
// so it follows that `length - 1 + offset_idx < OFFSETS`, therefore
114
117
// `offset_idx < OFFSETS` is always true in this loop.
115
- unsafe { crate :: hint:: assert_unchecked ( offset_idx < OFFSETS ) } ;
118
+ //
119
+ // We need to use `intrinsics::assume` since the `panic_nounwind` contained
120
+ // in `hint::assert_unchecked` may not be optimized out.
121
+ unsafe { crate :: intrinsics:: assume ( offset_idx < OFFSETS ) } ;
116
122
let offset = offsets[ offset_idx] ;
117
123
prefix_sum += offset as u32 ;
118
124
if prefix_sum > total {
You can’t perform that action at this time.
0 commit comments