Skip to content

Commit 048b3ec

Browse files
committed
Optimize Ascii.is_alphabetic()
1 parent c1d7ca0 commit 048b3ec

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

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

0 commit comments

Comments
 (0)