git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3876
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2005-08-23 Bernhard Held <bernhard AT bernhardheld.de>
+
+ * src/SDCCopt.c (convertToFcall): fixed modulus with divisors 1 and
+ ffffffffu
+
2005-08-23 Maarten Brock <sourceforge.brock AT dse.nl>
* as/mcs51/aslink.h: completed lkrloc.c prototypes
if (ic->op == '%' && isOperandLiteral(IC_RIGHT(ic)) &&
IS_UNSIGNED(operandType(IC_LEFT(ic))))
{
- unsigned litVal = abs((int)operandLitValue(IC_RIGHT(ic)));
+ unsigned litVal = fabs(operandLitValue(IC_RIGHT(ic)));
+ /* modulo by 1: no remainder */
+ if (litVal == 1)
+ {
+ ic->op = '=';
+ IC_RIGHT (ic) = operandFromLit(0);
+ IC_LEFT (ic) = NULL;
+ continue;
+ }
// See if literal value is a power of 2.
while (litVal && !(litVal & 1))
{