* support/regression/tests/swap.c: 64 bit hosts failed
[fw/sdcc] / support / regression / tests / swap.c
index fbec0ec23e5fcc3a0ad318ad230e1537eefc8571..4dbe4ec9901422ce1ba15f68c1cb340a2535571b 100644 (file)
@@ -22,7 +22,7 @@ static void testSwap_4(void)
 }
 
 
-#define SWAP_8(x) (((x)<<8)|((x)>>8))
+#define SWAP_8(x) ((((x)<<8)|((x)>>8)) & 0xffff)
 
 static void testSwap_8(void)
 {
@@ -64,8 +64,7 @@ static void testSwap_8(void)
 }
 
 
-#define SWAP_16(x) (((x)<<16) | ((x)>>16))
-#define SWAP_16_2(x) ((unsigned int)((SWAP_8((unsigned int)x))<<16) | (SWAP_8(x)>>16))
+#define SWAP_16(x) ((((x)<<16) | ((x)>>16)) & 0xffffFFFF)
 
 static void testSwap_16(void)
 {
@@ -77,10 +76,6 @@ static void testSwap_16(void)
     tt = SWAP_16(tt);
     ASSERT( tt == SWAP_16(TEST_VECT_32));
 
-    tt = t;
-    tt = SWAP_16_2(tt);
-    ASSERT( tt == SWAP_16_2(TEST_VECT_32));
-
     /* swapping union with little register pressure */
     {
         unsigned char c;