X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=support%2Fregression%2Ftests%2Fliteralop.c;h=57a835e68adc02c2835fec0abf85cf87537437e3;hb=f3946e669d77d841b638d798c3e09429cd3338c6;hp=08800c1471f39149401ca85a8cf48604b21cde72;hpb=c4e2d5daae13c63de360bc8b9a60a0667b8c536a;p=fw%2Fsdcc diff --git a/support/regression/tests/literalop.c b/support/regression/tests/literalop.c index 08800c14..57a835e6 100644 --- a/support/regression/tests/literalop.c +++ b/support/regression/tests/literalop.c @@ -40,6 +40,12 @@ volatile utype vu; unsigned LONG t1, t2; +int +mulWrapper(int a, int b) +{ + return a * b; +} + void testOpOp(void) { @@ -77,7 +83,7 @@ testOpOp(void) ASSERT((stype) 1 * (utype) 0xfffffff7 == (utype) 0xfffffff7); ASSERT((unsigned char ) 0xfffffff8 * (unsigned char ) 0xfffffff7 == 0xef48); - ASSERT((unsigned short) 0xfffffff8 * (unsigned short) 0xfffffff7 == (sizeof(int) == 2 ? 0x0048 : 0xffef0048)); + ASSERT(mulWrapper((unsigned short) 0xfffffff8, (unsigned short) 0xfffffff7) == (sizeof(int) == 2 ? 0x0048 : (unsigned int)0xffef0048)); ASSERT((unsigned LONG ) 0xfffffff8 * (unsigned LONG ) 0xfffffff7 == 0x0048); ASSERT((stype ) 0xfffffff8 * (stype ) 0xfffffff7 == 72); @@ -108,8 +114,8 @@ testOpOp(void) if (sizeof (int) == 2) ASSERT(0x7fff * (unsigned char) 2 < 1); else - ASSERT(0x7fffffff * (unsigned char) 2 < 1); - ASSERT(0x7fffffff * (unsigned short) 2 < 1); + ASSERT(mulWrapper(0x7fffffff, (unsigned char) 2) < 1); + ASSERT(mulWrapper(0x7fffffff, (unsigned short) 2) < 1); /* mul icode: operandOperation() */ s = -3;