fixed: did not compute hexadecimal numbers right

This commit is contained in:
ceriel 1988-04-26 13:47:02 +00:00
parent 6722c28d81
commit bfd4554758

View file

@ -496,9 +496,17 @@ again:
tk->TOK_INT = 0; tk->TOK_INT = 0;
while (*np) { while (*np) {
arith old = tk->TOK_INT; arith old = tk->TOK_INT;
int c;
if (is_dig(*np)) {
c = *np++ - '0';
}
else {
assert(is_hex(*np));
c = *np++ - 'A' + 10;
}
tk->TOK_INT = tk->TOK_INT*base tk->TOK_INT = tk->TOK_INT*base
+ (*np++ - '0'); + c;
sgnswtch += (old < 0) ^ sgnswtch += (old < 0) ^
(tk->TOK_INT < 0); (tk->TOK_INT < 0);
} }