Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ Kyle J Strand <[email protected]> <[email protected]>
Kyle J Strand <[email protected]> <[email protected]>
Kyle J Strand <[email protected]> <[email protected]>
Kyle J Strand <[email protected]> <[email protected]>
Laurențiu Nicola <[email protected]>
Laurențiu Nicola <[email protected]> Laurentiu Nicola <[email protected]>
Laurențiu Nicola <[email protected]> <[email protected]>
Lee Jeffery <[email protected]> Lee Jeffery <[email protected]>
Lee Wondong <[email protected]>
Lennart Kudling <[email protected]>
Expand Down
15 changes: 12 additions & 3 deletions library/core/src/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,9 +1544,18 @@ impl char {
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
pub const fn is_ascii_whitespace(&self) -> bool {
match *self {
'\t' | '\n' | '\x0C' | '\r' | ' ' => true,
_ => false,
#[cfg(target_pointer_width = "64")]
{
// Inspired from https://pdimov.github.io/blog/2020/07/19/llvm-and-memchr/
const MASK: u64 = 1 << b'\t' | 1 << b'\n' | 1 << b'\x0C' | 1 << b'\r' | 1 << b' ';
*self <= ' ' && 1u64 << (*self as u8) & MASK != 0
}
#[cfg(not(target_pointer_width = "64"))]
{
match *self {
'\t' | '\n' | '\x0C' | '\r' | ' ' => true,
_ => false,
}
}
}

Expand Down