Skip to content

Commit 9b21b68

Browse files
committed
Revert "Use intrinsics::assume instead of hint::assert_unchecked."
This reverts commit 90ebc24.
1 parent 90ebc24 commit 9b21b68

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

library/core/src/unicode/unicode_data.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ unsafe fn skip_search<const SOR: usize, const OFFSETS: usize>(
9494
// correct location cannot be past it, so `Err(idx) => idx != length` either.
9595
//
9696
// This means that we can avoid bounds checking for the accesses below, too.
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) };
97+
unsafe { crate::hint::assert_unchecked(last_idx < SOR) };
10198

10299
let mut offset_idx = short_offset_runs[last_idx].start_index();
103100
let length = if let Some(next) = short_offset_runs.get(last_idx + 1) {
@@ -115,10 +112,7 @@ unsafe fn skip_search<const SOR: usize, const OFFSETS: usize>(
115112
// SAFETY: It is guaranteed that `length <= OFFSETS - offset_idx`,
116113
// so it follows that `length - 1 + offset_idx < OFFSETS`, therefore
117114
// `offset_idx < OFFSETS` is always true in this loop.
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) };
115+
unsafe { crate::hint::assert_unchecked(offset_idx < OFFSETS) };
122116
let offset = offsets[offset_idx];
123117
prefix_sum += offset as u32;
124118
if prefix_sum > total {

src/tools/unicode-table-generator/src/range_search.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ unsafe fn skip_search<const SOR: usize, const OFFSETS: usize>(
9292
// correct location cannot be past it, so `Err(idx) => idx != length` either.
9393
//
9494
// This means that we can avoid bounds checking for the accesses below, too.
95-
//
96-
// We need to use `intrinsics::assume` since the `panic_nounwind` contained
97-
// in `hint::assert_unchecked` may not be optimized out.
98-
unsafe { crate::intrinsics::assume(last_idx < SOR) };
95+
unsafe { crate::hint::assert_unchecked(last_idx < SOR) };
9996

10097
let mut offset_idx = short_offset_runs[last_idx].start_index();
10198
let length = if let Some(next) = short_offset_runs.get(last_idx + 1) {
@@ -113,10 +110,7 @@ unsafe fn skip_search<const SOR: usize, const OFFSETS: usize>(
113110
// SAFETY: It is guaranteed that `length <= OFFSETS - offset_idx`,
114111
// so it follows that `length - 1 + offset_idx < OFFSETS`, therefore
115112
// `offset_idx < OFFSETS` is always true in this loop.
116-
//
117-
// We need to use `intrinsics::assume` since the `panic_nounwind` contained
118-
// in `hint::assert_unchecked` may not be optimized out.
119-
unsafe { crate::intrinsics::assume(offset_idx < OFFSETS) };
113+
unsafe { crate::hint::assert_unchecked(offset_idx < OFFSETS) };
120114
let offset = offsets[offset_idx];
121115
prefix_sum += offset as u32;
122116
if prefix_sum > total {

0 commit comments

Comments
 (0)