Better inline of isDigit

This commit is contained in:
Jared Ramirez 2021-07-18 14:13:12 -07:00
parent 074aba0012
commit a763e046fc

View file

@ -62,8 +62,7 @@ pub const RocDec = extern struct {
continue;
}
// Is the char anything but digit?
if ((byte -% 48) > 9) {
if (!isDigit(byte)) {
return null;
}
index += 1;
@ -124,6 +123,10 @@ pub const RocDec = extern struct {
}
}
inline fn isDigit(c: u8) bool {
return (c -% 48) <= 9;
}
pub fn toStr(self: RocDec) ?RocStr {
// Special case
if (self.num == 0) {