shithub: scc

Download patch

ref: 7e16db5266a4c029474fe364b70b4bd77190ab43
parent: 1accaa337ab984f599a4fe9c951ef14b7155f844
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Oct 7 17:55:28 EDT 2015

The most portable solution in the world

The portable god will be very happy with us today.

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -273,7 +273,8 @@
 		++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;