File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1544,13 +1544,18 @@ impl char {
15441544 #[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
15451545 #[ inline]
15461546 pub const fn is_ascii_whitespace ( & self ) -> bool {
1547- #[ cfg( target_pointer_width = "64" ) ]
1547+ #[ cfg( not ( target_pointer_width = "16" ) ) ]
15481548 {
15491549 // 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
15521557 }
1553- #[ cfg( not ( target_pointer_width = "64" ) ) ]
1558+ #[ cfg( target_pointer_width = "16" ) ]
15541559 {
15551560 match * self {
15561561 '\t' | '\n' | '\x0C' | '\r' | ' ' => true ,
You can’t perform that action at this time.
0 commit comments