2 !!DESCRIPTION!! Substraction Test
3 !!ORIGIN!! SDCC regression tests
4 !!LICENCE!! GPL, read COPYING.GPL
10 unsigned char success=0;
11 unsigned char failures=0;
12 unsigned char dummy=0;
31 #ifdef SIZEOF_INT_16BIT
32 #if defined(__LINUX__) || defined(LINUX)
33 unsigned short aint0 = 0;
34 unsigned short aint1 = 0;
36 unsigned int aint0 = 0;
37 unsigned int aint1 = 0;
41 unsigned int aint0 = 0;
42 unsigned int aint1 = 0;
44 unsigned char achar0 = 0;
45 unsigned char achar1 = 0;
46 unsigned char achar2 = 0;
47 unsigned char achar3 = 0;
48 unsigned char *acharP = 0;
55 void sub_lit_from_uchar(void)
67 achar0 = achar0 -1; /* Should be a decrement */
71 for(achar1 = 0; achar1 < 100; achar1++)
82 void sub_uchar2uchar(void)
84 achar1 = achar1 - achar0;
89 for(achar2 = 0; achar2<7; achar2++)
99 achar2, achar3 can be anything.
101 void sub_uchar2uchar2(void)
114 achar2 = achar1 - achar0;
118 achar3 = achar2 - achar1 - achar0;
124 all bit variables are 0 upon entry.
126 #if SUPPORT_BIT_TYPES
136 bit1 = bit0-bit1; /* 1 - 0 => 1 */
140 #if SUPPORT_BIT_ARITHMETIC
141 bit2 = bit1-bit0; /* 1 - 1 => 0 */
147 bit3 = bit4-bit5-bit6-bit7-bit0; /* 0-0-0-0-1 => 1 */
153 /* sub_bit2uchar(void) - assumes bit0 = 1, achar0 = 7 */
155 void sub_bit2uchar(void)
166 void sub_bit2uint(void)
177 void sub_ucharFromLit(void)
183 printf("%x != %x\n",0x02,achar0);
191 printf("%x != %x\n",0x02,aint0);
199 printf("%x != %x\n",0x01,aint0);
203 aint0 = 0x100 - aint0;
207 printf("%x != %x\n",0xff,aint0);
211 aint0 = 0xff00 - aint0;
215 printf("%x != %x\n",0xfe01,aint0);
219 aint0 = 0x0e01 - aint0;
223 printf("%x != %x\n",0x1000,aint0);
227 aint0 = 0x10ff - aint0;
231 printf("%x != %x\n",0xff,aint0);
238 sub_lit_from_uchar();
239 printf("failures: %d\n",failures);
244 printf("failures: %d\n",failures);
249 printf("failures: %d\n",failures);
251 #if SUPPORT_BIT_TYPES
257 printf("failures: %d\n",failures);
259 printf("failures: %d\n",failures);
269 printf("failures: %d\n",failures);