commit 7e16db5266a4c029474fe364b70b4bd77190ab43
parent 1accaa337ab984f599a4fe9c951ef14b7155f844
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 7 Oct 2015 21:55:28 +0200
The most portable solution in the world
The portable god will be very happy with us today.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cc1/lex.c b/cc1/lex.c
@@ -273,7 +273,8 @@ readint(char *s, int base, int sign, Symbol *sym)
++s;
for (u = 0; isxdigit(c = *s++); u = u*base + val) {
- val = (isdigit(c)) ? c - '0' : 10 + toupper(c) - 'A';
+ static char letters[] = "0123456789ABCDEF";
+ val = strchr(letters, c) - letters;
repeat:
if (u <= max/base && u*base <= max - val)
continue;