File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1544,13 +1544,18 @@ impl char {
1544
1544
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1545
1545
#[ inline]
1546
1546
pub const fn is_ascii_whitespace ( & self ) -> bool {
1547
- #[ cfg( target_pointer_width = "64" ) ]
1547
+ #[ cfg( not ( target_pointer_width = "16" ) ) ]
1548
1548
{
1549
1549
// Inspired from https://pdimov.github.io/blog/2020/07/19/llvm-and-memchr/
1550
- const MASK : u64 = 1 << b'\t' | 1 << b'\n' | 1 << b'\x0C' | 1 << b'\r' | 1 << b' ' ;
1551
- * self <= ' ' && 1u64 << ( * self as u8 ) & MASK != 0
1550
+ const MASK : u32 = 1 << ( b'\t' - 1 )
1551
+ | 1 << ( b'\n' - 1 )
1552
+ | 1 << ( b'\x0C' - 1 )
1553
+ | 1 << ( b'\r' - 1 )
1554
+ | 1 << ( b' ' - 1 ) ;
1555
+ let ch = ( * self as u32 ) . wrapping_sub ( 1 ) ;
1556
+ ch < ( ' ' as u32 ) && 1 << ( ch as u8 ) & MASK != 0
1552
1557
}
1553
- #[ cfg( not ( target_pointer_width = "64" ) ) ]
1558
+ #[ cfg( target_pointer_width = "16" ) ]
1554
1559
{
1555
1560
match * self {
1556
1561
'\t' | '\n' | '\x0C' | '\r' | ' ' => true ,
You can’t perform that action at this time.
0 commit comments