Skip to content

Commit 984cc28

Browse files
committed
Optimize Ascii.is_alphabetic()
1 parent ddf9c7d commit 984cc28

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
@@ -238,8 +238,8 @@ impl Ascii {
238238
/// Check if the character is a letter (a-z, A-Z)
239239
#[inline]
240240
pub fn is_alphabetic(&self) -> bool {
241-
(self >= &Ascii::a && self <= &Ascii::z) ||
242-
(self >= &Ascii::A && self <= &Ascii::Z)
241+
let c = self.as_byte() | 0b010_0000;// Turns uppercase into lowercase.
242+
c >= b'a' && c <= b'z'
243243
}
244244

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

0 commit comments

Comments
 (0)