Overflow test optimization suggested by kugelfuhr
User CHAR_BIT instead of 8
This commit is contained in:
@@ -590,19 +590,15 @@ static void NumericConst (void)
|
|||||||
SB_Clear (&Src);
|
SB_Clear (&Src);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (((scan_t)(IVal * Base) / Base) != IVal) {
|
if (((scan_t)(IVal * Base + DigitVal) / Base) != IVal) {
|
||||||
Overflow = 1;
|
Overflow = 1;
|
||||||
}
|
}
|
||||||
IVal = IVal * Base;
|
IVal = IVal * Base + DigitVal;
|
||||||
if (((scan_t)(IVal + DigitVal)) < IVal) {
|
|
||||||
Overflow = 1;
|
|
||||||
}
|
|
||||||
IVal += DigitVal;
|
|
||||||
SB_Skip (&Src);
|
SB_Skip (&Src);
|
||||||
}
|
}
|
||||||
if (Overflow) {
|
if (Overflow) {
|
||||||
Error ("Numerical constant \"%s\" too large for internal %d-bit representation",
|
Error ("Numerical constant \"%s\" too large for internal %d-bit representation",
|
||||||
SB_GetConstBuf (&Src), (int)(sizeof(IVal)*8));
|
SB_GetConstBuf (&Src), (int)(sizeof(IVal)*CHAR_BIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Distinguish between integer and floating point constants */
|
/* Distinguish between integer and floating point constants */
|
||||||
|
|||||||
Reference in New Issue
Block a user