[hackers] [scc] Fix conversion of hexadecimal constants || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 7 Oct 2015 17:44:48 +0200 (CEST)

commit 2883d0179563960dacbe4c97ec78f3822aca7c29
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Oct 7 12:36:51 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Oct 7 17:23:30 2015 +0200

    Fix conversion of hexadecimal constants
    
    It is possible to have upper case or lower case letters in
    hexadecimal numbers, and the expression was only valid
    for upper case.

diff --git a/cc1/lex.c b/cc1/lex.c
index ad3a6b8..8d5a65e 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -273,7 +273,7 @@ readint(char *s, int base, int sign, Symbol *sym)
                 ++s;
 
         for (u = 0; isxdigit(c = *s++); u = u*base + val) {
- val = (c <= '9') ? c - '0' : 10 + c - 'A';
+ val = (c <= '9') ? c - '0' : 10 + toupper(c) - 'A';
         repeat:
                 if (u <= max/base && u*base <= max - val)
                         continue;
Received on Wed Oct 07 2015 - 17:44:48 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 07 2015 - 17:48:22 CEST