6 /* bit types are not ANSI - so provide a way of disabling bit types
7 * if this file is used to test other compilers besides SDCC */
8 #define SUPPORT_BIT_TYPES 0
10 /* Some compilers that support bit types do not support bit arithmetic
11 * (like bitx = bity + bitz;) */
12 #define SUPPORT_BIT_ARITHMETIC 0
31 unsigned int aint0
= 0;
32 unsigned int aint1
= 0;
33 unsigned char achar0
= 0;
34 unsigned char achar1
= 0;
35 unsigned char achar2
= 0;
36 unsigned char achar3
= 0;
37 unsigned char *acharP
= 0;
39 void sub_lit_from_uchar(void)
44 ASSERT(!(achar0
!= 0xfb));
48 ASSERT(!(achar0
!= 0xf1));
50 achar0
= achar0
-1; // Should be a decrement
51 ASSERT(!(achar0
!= 0xf0));
53 for(achar1
= 0; achar1
< 100; achar1
++)
56 ASSERT(!(achar0
!= 40));
63 void sub_uchar2uchar(void)
66 achar1
= achar1
- achar0
;
68 ASSERT(!(achar1
!= 99));
70 for(achar2
= 0; achar2
<7; achar2
++)
73 ASSERT(!(achar1
!= 92));
80 // achar2, achar3 can be anything.
82 void sub_uchar2uchar2(void)
90 ASSERT(!(achar0
!= 3));
94 ASSERT(!(achar1
!= 29));
96 achar2
= achar1
- achar0
;
97 ASSERT(!(achar2
!= 26));
100 achar3
= achar2
- achar1
- achar0
;
101 ASSERT(!(achar3
!= 0xfa));
106 // all bit variables are 0 upon entry.
108 #if SUPPORT_BIT_TYPES
116 ASSERT(!(bit1
!= 0));
118 bit1
= bit0
-bit1
; // 1 - 0 => 1
119 ASSERT(!(bit1
!= 1));
121 #if SUPPORT_BIT_ARITHMETIC
122 bit2
= bit1
-bit0
; // 1 - 1 => 0
127 bit3
= bit4
-bit5
-bit6
-bit7
-bit0
; // 0-0-0-0-1 => 1
132 /* sub_bit2uchar(void) - assumes bit0 = 1, achar0 = 7 */
134 void sub_bit2uchar(void)
139 ASSERT(!(achar0
!= 6));
141 ASSERT(!(achar0
== bit0
));
145 void sub_bit2uint(void)
148 ASSERT(!(aint0
!= bit11
));
151 ASSERT(!(aint0
!=0xffff));
160 sub_lit_from_uchar();
171 #if SUPPORT_BIT_TYPES