Skip to content

Commit 866e666

Browse files
committed
Fix compilation on 32-bit targets
1 parent c0639b8 commit 866e666

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/core/src/str/validations.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ const fn next_state(st: u32, byte: u8) -> u32 {
252252

253253
#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))]
254254
#[inline(always)]
255-
fn next_state(st: u32, byte: u8) -> u32 {
255+
const fn next_state(st: u32, byte: u8) -> u32 {
256256
// SAFETY: `u64` is more aligned than `u32`, and has the same repr as `[u32; 2]`.
257-
let [lo, hi] = unsafe { std::mem::transmute::<u64, [u32; 2]>(TRANS_TABLE[byte as usize]) };
257+
let [lo, hi] = unsafe { crate::mem::transmute::<u64, [u32; 2]>(TRANS_TABLE[byte as usize]) };
258258
#[cfg(target_endian = "big")]
259259
let (lo, hi) = (hi, lo);
260-
(st & 32 == 0).select_unpredictable(lo, hi).wrapping_shr(st)
260+
if st & 32 == 0 { lo } else { hi }.wrapping_shr(st)
261261
}
262262

263263
/// Check if `byte` is a valid UTF-8 first byte, assuming it must be a valid first or

0 commit comments

Comments
 (0)