fixed: did not compute hexadecimal numbers right
authorceriel <none@none>
Tue, 26 Apr 1988 13:47:02 +0000 (13:47 +0000)
committerceriel <none@none>
Tue, 26 Apr 1988 13:47:02 +0000 (13:47 +0000)
lang/m2/comp/LLlex.c

index ca1b208..4506d09 100644 (file)
@@ -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);
                                        }