From a8927bf27b57a1f49d525f628a97de9c1fce710b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 26 Nov 2014 17:26:58 +0000 Subject: 33793: add 0b binary interpretation to integer constants --- Src/math.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Src/math.c') diff --git a/Src/math.c b/Src/math.c index 266569827..438a17089 100644 --- a/Src/math.c +++ b/Src/math.c @@ -449,12 +449,14 @@ lexconstant(void) nptr++; if (*nptr == '0') { + int lowchar; nptr++; - if (*nptr == 'x' || *nptr == 'X') { + lowchar = tolower(*nptr); + if (lowchar == 'x' || lowchar == 'b') { /* Let zstrtol parse number with base */ yyval.u.l = zstrtol_underscore(ptr, &ptr, 0, 1); /* Should we set lastbase here? */ - lastbase = 16; + lastbase = (lowchar == 'b') ? 2 : 16; if (isset(FORCEFLOAT)) { yyval.type = MN_FLOAT; -- cgit 1.4.1