mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the char anything but digit?
|
if (!isDigit(byte)) {
|
||||||
if ((byte -% 48) > 9) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
index += 1;
|
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 {
|
pub fn toStr(self: RocDec) ?RocStr {
|
||||||
// Special case
|
// Special case
|
||||||
if (self.num == 0) {
|
if (self.num == 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue