core: all int is now num

This commit is contained in:
2023-06-18 20:03:27 +02:00
parent 1b878db8fe
commit 85a5b567b2
8 changed files with 31 additions and 27 deletions

View File

@ -1,13 +1,10 @@
atoi(str)
aton(str)
{
local i = 0;
local sign = 0;
local out = 0;
loop {
if ([str + i] == '-')
sign = sign == 0;
else if ([str + i] != '+')
if ([str + i] != '+')
break;
i++;
}
@ -17,7 +14,5 @@ atoi(str)
out = out * 10 + [str + i] - '0';
i++;
}
if (sign)
return (0 - out);
return out;
}