Skip to content

Commit 80e3d8a

Browse files
committed
Use is_ascii_digit() instead of manual range check
1 parent 41b5c75 commit 80e3d8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn parse_float(bytes: &[u8]) -> i32 {
3434
let neg = (bytes[0] == b'-') as usize;
3535
let sgn = 1 - 2 * neg as i32;
3636
let res = bytes.iter().skip(neg).fold(0, |acc, &byte| {
37-
let is_digit = (b'0' <= byte && byte <= b'9') as i32;
37+
let is_digit = byte.is_ascii_digit() as i32;
3838
let digit = (byte as i32).wrapping_sub(b'0' as i32);
3939
acc * (10 * is_digit + (1 - is_digit)) + digit * is_digit
4040
});

0 commit comments

Comments
 (0)