20 lines
290 B
Plaintext
20 lines
290 B
Plaintext
aton_s(str)
|
|
{
|
|
local sign = 0;
|
|
local out = 0;
|
|
|
|
loop {
|
|
if ([str] == '-')
|
|
sign = sign == 0;
|
|
else if ([str] != '+')
|
|
break;
|
|
str++;
|
|
}
|
|
loop {
|
|
if ([str] == 0 | isdigit([str]) == 0)
|
|
return (sign * (0 - out)) | ((sign == 0) * out);
|
|
out = out * 10 + [str] - '0';
|
|
str++;
|
|
}
|
|
}
|