mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
Better inline of isDigit
This commit is contained in:
parent
074aba0012
commit
a763e046fc
1 changed files with 5 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue