From f8dfa6912fc1d876fbfc175d4e0182cf3cb1c363 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 26 Apr 1988 13:47:02 +0000 Subject: [PATCH] fixed: did not compute hexadecimal numbers right --- lang/m2/comp/LLlex.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/m2/comp/LLlex.c b/lang/m2/comp/LLlex.c index ca1b208a..4506d097 100644 --- a/lang/m2/comp/LLlex.c +++ b/lang/m2/comp/LLlex.c @@ -496,9 +496,17 @@ again: tk->TOK_INT = 0; while (*np) { 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 - + (*np++ - '0'); + + c; sgnswtch += (old < 0) ^ (tk->TOK_INT < 0); }