Skip to content

Commit 218d7a8

Browse files
committed
Optimize Ascii.is_alphabetic()
1 parent e8c821f commit 218d7a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ascii.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ impl Ascii {
198198
/// Check if the character is a letter (a-z, A-Z)
199199
#[inline]
200200
pub fn is_alphabetic(&self) -> bool {
201-
(self >= &Ascii::a && self <= &Ascii::z) ||
202-
(self >= &Ascii::A && self <= &Ascii::Z)
201+
let c = self.as_byte() | 0b010_0000;// Turns uppercase into lowercase.
202+
c >= b'a' && c <= b'z'
203203
}
204204

205205
/// Check if the character is a number (0-9)

0 commit comments

Comments
 (0)