Added negative numbers support
This commit is contained in:
parent
3d9ecb0b7b
commit
d24af00098
|
@ -34,10 +34,11 @@ walk(char *s)
|
|||
static int
|
||||
sint(char *s)
|
||||
{
|
||||
int r = 0;
|
||||
char c;
|
||||
int r = 0, n = 1;
|
||||
if(*s == '-') { n = -1, s++; }
|
||||
while((c = *s++) && c > 0x20) r = r * 10 + c - '0';
|
||||
return r;
|
||||
return r * n;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue