forked from starnakin/IronGOLEM
core: all int is now num
This commit is contained in:
@ -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;
|
||||
}
|
Reference in New Issue
Block a user