/* Test operandOperation() in SDCCicode.c
- type: char, short, long
+ type: char, short, LONG
*/
#include <testfwk.h>
+/* 64 bit hosts */
+#if defined(__alpha) || defined(__amd64)
+# define LONG int
+#else
+# define LONG long
+#endif
+
typedef signed {type} stype;
typedef unsigned {type} utype;
signed char sc;
signed short ss;
-signed long sl;
+signed LONG sl;
unsigned char uc;
unsigned short us;
-unsigned long ul;
+unsigned LONG ul;
volatile signed char vsc;
volatile signed short vss;
-volatile signed long vsl;
+volatile signed LONG vsl;
volatile unsigned char vuc;
volatile unsigned short vus;
-volatile unsigned long vul;
+volatile unsigned LONG vul;
stype s;
volatile stype vs;
utype u;
volatile utype vu;
-unsigned long t1, t2;
+unsigned LONG t1, t2;
void
testOpOp(void)
ASSERT((unsigned char ) 0xfffffff8 * (unsigned char ) 0xfffffff7 == 0xef48);
ASSERT((unsigned short) 0xfffffff8 * (unsigned short) 0xfffffff7 == (sizeof(int) == 2 ? 0x0048 : 0xffef0048));
- ASSERT((unsigned long ) 0xfffffff8 * (unsigned long ) 0xfffffff7 == 0x0048);
+ ASSERT((unsigned LONG ) 0xfffffff8 * (unsigned LONG ) 0xfffffff7 == 0x0048);
ASSERT((stype ) 0xfffffff8 * (stype ) 0xfffffff7 == 72);
ASSERT((signed char ) -1 * (unsigned char ) 0xfffffff7 == (sizeof(int) == 2 ? 0xff09 : 0xffffff09));
ASSERT((signed short) -1 * (unsigned short) 0xfffffff7 == (sizeof(int) == 2 ? 9u : 0xffff0009));
- ASSERT((signed long ) -1 * (unsigned long ) 0xfffffff7 == 9u);
+ ASSERT((signed LONG ) -1 * (unsigned LONG ) 0xfffffff7 == 9u);
ASSERT((signed char ) -2 * (unsigned char ) 0x8004 == (sizeof(int) == 2 ? 0xfff8 : 0xfffffff8));
ASSERT((signed short) -2 * (unsigned short) 0x8004 == (sizeof(int) == 2 ? 0xfff8 : 0xfffefff8));
- ASSERT((signed long ) -2 * (unsigned long ) 0x8004 == 0xfffefff8);
+ ASSERT((signed LONG ) -2 * (unsigned LONG ) 0x8004 == 0xfffefff8);
ASSERT(-1 * 0xfff7 == (sizeof(int) == 2 ? 9 : 0xffff0009)); // 0xfff7 is stored in 'unsigned int'
// but:
- ASSERT(-1 * 65527 == -65527); // 65527 (== 0xfff7) is stored in 'signed long'
+ ASSERT(-1 * 65527 == -65527); // 65527 (== 0xfff7) is stored in 'signed LONG'
ASSERT(-1 * 33000 == -33000);
ASSERT(1 * 10000 * is8 == (sizeof(int) == 2 ? 14464 : 80000)); /* int */
- ASSERT(1 * 10000l * is8 == 80000); /* long */
+ ASSERT(1 * 10000l * is8 == 80000); /* LONG */
ASSERT(1 * 40000u * is8 == (sizeof(int) == 2 ? 57856u : 320000)); /* unsigned */
- ASSERT(1 * 40000 * is8 == 320000); /* long */
+ ASSERT(1 * 40000 * is8 == 320000); /* LONG */
ASSERT(1 * 0x4000 * is8 == (sizeof(int) == 2 ? 0 : 0x20000)); /* unsigned */
ASSERT(-1 * 1 < 0);
ASSERT(uc * (unsigned char ) 0xfffffff7 == 0xef48);
us = (unsigned short) 0xfffffff8;
ASSERT(us * (unsigned short) 0xfffffff7 == (sizeof(int) == 2 ? 0x0048 : 0xffef0048));
- ul = (unsigned long ) 0xfffffff8;
- ASSERT(ul * (unsigned long ) 0xfffffff7 == 0x0048);
- ul = (unsigned long ) 0xfffffff8;
+ ul = (unsigned LONG ) 0xfffffff8;
+ ASSERT(ul * (unsigned LONG ) 0xfffffff7 == 0x0048);
+ ul = (unsigned LONG ) 0xfffffff8;
ASSERT((stype ) 0xfffffff8 * (stype ) 0xfffffff7 == 72);
ASSERT((signed char ) -1 * (unsigned char ) 0xfffffff7 == (sizeof(int) == 2 ? 0xff09 : 0xffffff09));
ASSERT((signed short) -1 * (unsigned short) 0xfffffff7 == (sizeof(int) == 2 ? 9u : 0xffff0009));
- ASSERT((signed long ) -1 * (unsigned long ) 0xfffffff7 == 9u);
+ ASSERT((signed LONG ) -1 * (unsigned LONG ) 0xfffffff7 == 9u);
ASSERT((signed char ) -2 * (unsigned char ) 0x8004 == (sizeof(int) == 2 ? 0xfff8 : 0xfffffff8));
ASSERT((signed short) -2 * (unsigned short) 0x8004 == (sizeof(int) == 2 ? 0xfff8 : 0xfffefff8));
- ASSERT((signed long ) -2 * (unsigned long ) 0x8004 == 0xfffefff8);
+ ASSERT((signed LONG ) -2 * (unsigned LONG ) 0x8004 == 0xfffefff8);