2023-06-18 14:07:13 -04:00
|
|
|
aton_s(str)
|
|
|
|
{
|
|
|
|
local sign = 0;
|
|
|
|
local out = 0;
|
|
|
|
|
|
|
|
loop {
|
2023-07-24 23:43:10 -04:00
|
|
|
if ([str] == '-')
|
2023-06-18 14:07:13 -04:00
|
|
|
sign = sign == 0;
|
2023-07-24 23:43:10 -04:00
|
|
|
else if ([str] != '+')
|
2023-06-18 14:07:13 -04:00
|
|
|
break;
|
2023-07-24 23:43:10 -04:00
|
|
|
str++;
|
2023-06-18 14:07:13 -04:00
|
|
|
}
|
|
|
|
loop {
|
2023-07-24 23:43:10 -04:00
|
|
|
if ([str] == 0 | isdigit([str]) == 0)
|
|
|
|
return (sign * (0 - out)) | ((sign == 0) * out);
|
|
|
|
out = out * 10 + [str] - '0';
|
|
|
|
str++;
|
2023-06-18 14:07:13 -04:00
|
|
|
}
|
|
|
|
}
|