summaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index ac222eebda8..f7fe054b7e0 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -129,14 +129,9 @@ parse_number (pfile, tok)
{
c = *p;
- if (ISDIGIT (c))
- digit = c - '0';
- /* We believe that in all live character sets, a-f are
- consecutive, and so are A-F. */
- else if (base == 16 && c >= 'a' && c <= 'f')
- digit = c - 'a' + 10;
- else if (base == 16 && c >= 'A' && c <= 'F')
- digit = c - 'A' + 10;
+ if (ISDIGIT (c)
+ || (base == 16 && ISXDIGIT (c)))
+ digit = hex_value (c);
else
break;