Changeset 4f89e7b
- Timestamp:
- Aug 9, 2021, 4:21:29 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 50b29d9
- Parents:
- ea54f1e
- Location:
- tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/bitmanip3.cfa
rea54f1e r4f89e7b 10 10 // Created On : Tue Apr 7 21:22:59 2020 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 24 09:53:26 202013 // Update Count : 6612 // Last Modified On : Sun Aug 8 23:12:19 2021 13 // Update Count : 76 14 14 // 15 15 … … 133 133 sout | nl | "floor2" | nl | nl; 134 134 135 printf( "signed char\n" );135 sout | "signed char"; 136 136 for ( sc = 1; sc != 0; sc <<= 1 ) { 137 137 scr1 = floor2( sc, sc ); scr2 = floor2( sc + 2hh, sc ); scr3 = floor2( -sc - 2hh, sc ); 138 printf( "floor2(%hhd, %hhd) = %hhd, floor2(%hhd, %hhd) = %hhd, floor2(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 ); 139 } // for 140 printf( "\n" ); 141 142 printf( "unsigned char\n" ); 138 // printf( "floor2(%hhd, %hhd) = %hhd, floor2(%hhd, %hhd) = %hhd, floor2(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 ); 139 sout | "floor2(" | sc | "," | sc | ") = " | scr1 | ", floor2(" | sc + 2hh | "," | sc | ") = " | scr2 | ", floor2(" | -sc - 2hh | "," | sc | ") = " | scr3; 140 } // for 141 sout | nl; 142 143 sout | "unsigned char"; 143 144 for ( uc = 1; uc != 0; uc <<= 1 ) { 144 145 ucr1 = floor2( uc, uc ); ucr2 = floor2( uc + 2hh, uc ); ucr3 = floor2( -uc - 2hh, uc ); 145 printf( "floor2(%hhu, %hhu) = %hhu, floor2(%hhu, %hhu) = %hhu, floor2(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 ); 146 } // for 147 printf( "\n" ); 148 149 printf( "short int\n" ); 146 // printf( "floor2(%hhu, %hhu) = %hhu, floor2(%hhu, %hhu) = %hhu, floor2(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 ); 147 sout | "floor2(" | uc | "," | uc | ") = " | ucr1 | ", floor2(" | uc + 2uhh | "," | uc | ") = " | ucr2 | ", floor2(" | -uc - 2uhh | "," | uc | ") = " | ucr3; 148 } // for 149 sout | nl; 150 151 sout | "short int"; 150 152 for ( si = 1; si != 0; si <<= 1 ) { 151 153 sir1 = floor2( si, si ); sir2 = floor2( si + 2hh, si ); sir3 = floor2( -si - 2hh, si ); 152 printf( "floor2(%hd, %hd) = %hd, floor2(%hd, %hd) = %hd, floor2(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 ); 153 } // for 154 printf( "\n" ); 155 156 printf( "unsigned short int\n" ); 154 // printf( "floor2(%hd, %hd) = %hd, floor2(%hd, %hd) = %hd, floor2(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 ); 155 sout | "floor2(" | si | "," | si | ") = " | sir1 | ", floor2(" | si + 2h | "," | si | ") = " | sir2 | ", floor2(" | -si - 2h | "," | si | ") = " | sir3; 156 } // for 157 sout | nl; 158 159 sout | "unsigned short int"; 157 160 for ( usi = 1; usi != 0; usi <<= 1 ) { 158 161 usir1 = floor2( usi, usi ); usir2 = floor2( usi + 2hh, usi ); usir3 = floor2( -usi - 2hh, usi ); 159 printf( "floor2(%hu, %hu) = %hu, floor2(%hu, %hu) = %hu, floor2(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 ); 160 } // for 161 printf( "\n" ); 162 163 printf( "int\n" ); 162 // printf( "floor2(%hu, %hu) = %hu, floor2(%hu, %hu) = %hu, floor2(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 ); 163 sout | "floor2(" | usi | "," | usi | ") = " | usir1 | ", floor2(" | usi + 2uh | "," | usi | ") = " | usir2 | ", floor2(" | -usi - 2uh | "," | usi | ") = " | usir3; 164 } // for 165 sout | nl; 166 167 sout | "int"; 164 168 for ( i = 1; i != 0; i <<= 1 ) { 165 169 ir1 = floor2( i, i ); ir2 = floor2( i + 2hh, i ); ir3 = floor2( -i - 2hh, i ); 166 printf( "floor2(%d, %d) = %d, floor2(%d, %d) = %d, floor2(%d, %d) = %d\n", i, i, ir1, i + 2h, i, ir2, -i - 2h, i, ir3 ); 167 } // for 168 printf( "\n" ); 169 170 printf( "unsigned int\n" ); 170 // printf( "floor2(%d, %d) = %d, floor2(%d, %d) = %d, floor2(%d, %d) = %d\n", i, i, ir1, i + 2, i, ir2, -i - 2, i, ir3 ); 171 sout | "floor2(" | i | "," | i | ") = " | ir1 | ", floor2(" | i + 2 | "," | i | ") = " | ir2 | ", floor2(" | -i - 2 | "," | i | ") = " | ir3; 172 } // for 173 sout | nl; 174 175 sout | "unsigned int"; 171 176 for ( ui = 1; ui != 0; ui <<= 1 ) { 172 177 uir1 = floor2( ui, ui ); uir2 = floor2( ui + 2hh, ui ); uir3 = floor2( -ui - 2hh, ui ); 173 printf( "floor2(%u, %u) = %u, floor2(%u, %u) = %u, floor2(%u, %u) = %u\n", ui, ui, uir1, ui + 2h, ui, uir2, -ui - 2h, ui, uir3 ); 174 } // for 175 printf( "\n" ); 176 177 printf( "long int\n" ); 178 // printf( "floor2(%u, %u) = %u, floor2(%u, %u) = %u, floor2(%u, %u) = %u\n", ui, ui, uir1, ui + 2, ui, uir2, -ui - 2, ui, uir3 ); 179 sout | "floor2(" | ui | "," | ui | ") = " | uir1 | ", floor2(" | ui + 2 | "," | ui | ") = " | uir2 | ", floor2(" | -ui - 2 | "," | ui | ") = " | uir3; 180 } // for 181 sout | nl; 182 183 sout | "long int"; 178 184 for ( li = 1; li != 0; li <<= 1 ) { 179 185 lir1 = floor2( li, li ); lir2 = floor2( li + 2hh, li ); lir3 = floor2( -li - 2hh, li ); 180 printf( "floor2(%ld, %ld) = %ld, floor2(%ld, %ld) = %ld, floor2(%ld, %ld) = %ld\n", li, li, lir1, li + 2h, li, lir2, -li - 2h, li, lir3 ); 181 } // for 182 printf( "\n" ); 183 184 printf( "unsigned long int\n" ); 186 // printf( "floor2(%ld, %ld) = %ld, floor2(%ld, %ld) = %ld, floor2(%ld, %ld) = %ld\n", li, li, lir1, li + 2l, li, lir2, -li - 2l, li, lir3 ); 187 sout | "floor2(" | li | "," | li | ") = " | lir1 | ", floor2(" | li + 2l | "," | li | ") = " | lir2 | ", floor2(" | -li - 2l | "," | li | ") = " | lir3; 188 } // for 189 sout | nl; 190 191 sout | "unsigned long int"; 185 192 for ( uli = 1; uli != 0; uli <<= 1 ) { 186 193 ulir1 = floor2( uli, uli ); ulir2 = floor2( uli + 2hh, uli ); ulir3 = floor2( -uli - 2hh, uli ); 187 printf( "floor2(%lu, %lu) = %lu, floor2(%lu, %lu) = %lu, floor2(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2h, uli, ulir2, -uli - 2h, uli, ulir3 ); 188 } // for 189 printf( "\n" ); 190 191 printf( "long long int\n" ); 194 // printf( "floor2(%lu, %lu) = %lu, floor2(%lu, %lu) = %lu, floor2(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2l, uli, ulir2, -uli - 2l, uli, ulir3 ); 195 sout | "floor2(" | uli | "," | uli | ") = " | ulir1 | ", floor2(" | uli + 2l | "," | uli | ") = " | ulir2 | ", floor2(" | -uli - 2l | "," | uli | ") = " | ulir3; 196 } // for 197 sout | nl; 198 199 sout | "long long int"; 192 200 for ( lli = 1; lli != 0; lli <<= 1 ) { 193 201 llir1 = floor2( lli, lli ); llir2 = floor2( lli + 2hh, lli ); llir3 = floor2( -lli - 2hh, lli ); 194 printf( "floor2(%lld, %lld) = %lld, floor2(%lld, %lld) = %lld, floor2(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2h, lli, llir2, -lli - 2h, lli, llir3 ); 195 } // for 196 printf( "\n" ); 197 198 printf( "unsigned long long int\n" ); 202 // printf( "floor2(%lld, %lld) = %lld, floor2(%lld, %lld) = %lld, floor2(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2ll, lli, llir2, -lli - 2ll, lli, llir3 ); 203 sout | "floor2(" | lli | "," | lli | ") = " | llir1 | ", floor2(" | lli + 2ll | "," | lli | ") = " | llir2 | ", floor2(" | -lli - 2ll | "," | lli | ") = " | llir3; 204 } // for 205 sout | nl; 206 207 sout | "unsigned long long int"; 199 208 for ( ulli = 1; ulli != 0; ulli <<= 1 ) { 200 209 ullir1 = floor2( ulli, ulli ); ullir2 = floor2( ulli + 2hh, ulli ); ullir3 = floor2( -ulli - 2hh, ulli ); 201 printf( "floor2(%llu, %llu) = %llu, floor2(%llu, %llu) = %llu, floor2(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 ); 202 } // for 203 printf( "\n" ); 210 // printf( "floor2(%llu, %llu) = %llu, floor2(%llu, %llu) = %llu, floor2(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 ); 211 sout | "floor2(" | ulli | "," | ulli | ") = " | ullir1 | ", floor2(" | ulli + 2ll | "," | ulli | ") = " | ullir2 | ", floor2(" | -ulli - 2ll | "," | ulli | ") = " | ullir3; 212 } // for 213 sout | nl; 204 214 #endif // 0 205 215 //============================================================ … … 207 217 sout | nl | "ceiling2" | nl | nl; 208 218 209 printf( "signed char\n" );219 sout | "signed char"; 210 220 for ( sc = 1; sc != 0; sc <<= 1 ) { 211 221 scr1 = ceiling2( sc, sc ); scr2 = ceiling2( sc + 2hh, sc ); scr3 = ceiling2( -sc - 2hh, sc ); 212 printf( "ceiling2(%hhd, %hhd) = %hhd, ceiling2(%hhd, %hhd) = %hhd, ceiling2(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 ); 213 } // for 214 printf( "\n" ); 215 216 printf( "unsigned char\n" ); 222 // printf( "ceiling2(%hhd, %hhd) = %hhd, ceiling2(%hhd, %hhd) = %hhd, ceiling2(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 ); 223 sout | "ceiling2(" | sc | "," | sc | ") = " | scr1 | ", ceiling2(" | sc + 2hh | "," | sc | ") = " | scr2 | ", ceiling2(" | -sc - 2hh | "," | sc | ") = " | scr3; 224 } // for 225 sout | nl; 226 227 sout | "unsigned char"; 217 228 for ( uc = 1; uc != 0; uc <<= 1 ) { 218 229 ucr1 = ceiling2( uc, uc ); ucr2 = ceiling2( uc + 2hh, uc ); ucr3 = ceiling2( -uc - 2hh, uc ); 219 printf( "ceiling2(%hhu, %hhu) = %hhu, ceiling2(%hhu, %hhu) = %hhu, ceiling2(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 ); 220 } // for 221 printf( "\n" ); 222 223 printf( "short int\n" ); 230 // printf( "ceiling2(%hhu, %hhu) = %hhu, ceiling2(%hhu, %hhu) = %hhu, ceiling2(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 ); 231 sout | "ceiling2(" | uc | "," | uc | ") = " | ucr1 | ", ceiling2(" | uc + 2hh | "," | uc | ") = " | ucr2 | ", ceiling2(" | -uc - 2hh | "," | uc | ") = " | ucr3; 232 } // for 233 sout | nl; 234 235 sout | "short int"; 224 236 for ( si = 1; si != 0; si <<= 1 ) { 225 237 sir1 = ceiling2( si, si ); sir2 = ceiling2( si + 2hh, si ); sir3 = ceiling2( -si - 2hh, si ); 226 printf( "ceiling2(%hd, %hd) = %hd, ceiling2(%hd, %hd) = %hd, ceiling2(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 ); 227 } // for 228 printf( "\n" ); 229 230 printf( "unsigned short int\n" ); 238 // printf( "ceiling2(%hd, %hd) = %hd, ceiling2(%hd, %hd) = %hd, ceiling2(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 ); 239 sout | "ceiling2(" | si | "," | si | ") = " | sir1 | ", ceiling2(" | si + 2h | "," | si | ") = " | sir2 | ", ceiling2(" | -si - 2h | "," | si | ") = " | sir3; 240 } // for 241 sout | nl; 242 243 sout | "unsigned short int"; 231 244 for ( usi = 1; usi != 0; usi <<= 1 ) { 232 245 usir1 = ceiling2( usi, usi ); usir2 = ceiling2( usi + 2hh, usi ); usir3 = ceiling2( -usi - 2hh, usi ); 233 printf( "ceiling2(%hu, %hu) = %hu, ceiling2(%hu, %hu) = %hu, ceiling2(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 ); 234 } // for 235 printf( "\n" ); 236 237 printf( "int\n" ); 246 // printf( "ceiling2(%hu, %hu) = %hu, ceiling2(%hu, %hu) = %hu, ceiling2(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 ); 247 sout | "ceiling2(" | usi | "," | usi | ") = " | usir1 | ", ceiling2(" | usi + 2h | "," | usi | ") = " | usir2 | ", ceiling2(" | -usi - 2h | "," | usi | ") = " | usir3; 248 } // for 249 sout | nl; 250 251 sout | "int"; 238 252 for ( i = 1; i != 0; i <<= 1 ) { 239 253 ir1 = ceiling2( i, i ); ir2 = ceiling2( i + 2hh, i ); ir3 = ceiling2( -i - 2hh, i ); 240 printf( "ceiling2(%d, %d) = %d, ceiling2(%d, %d) = %d, ceiling2(%d, %d) = %d\n", i, i, ir1, i + 2h, i, ir2, -i - 2h, i, ir3 ); 241 } // for 242 printf( "\n" ); 243 244 printf( "unsigned int\n" ); 254 // printf( "ceiling2(%d, %d) = %d, ceiling2(%d, %d) = %d, ceiling2(%d, %d) = %d\n", i, i, ir1, i + 2, i, ir2, -i - 2, i, ir3 ); 255 sout | "ceiling2(" | i | "," | i | ") = " | ir1 | ", ceiling2(" | i + 2 | "," | i | ") = " | ir2 | ", ceiling2(" | -i - 2 | "," | i | ") = " | ir3; 256 } // for 257 sout | nl; 258 259 sout | "unsigned int"; 245 260 for ( ui = 1; ui != 0; ui <<= 1 ) { 246 261 uir1 = ceiling2( ui, ui ); uir2 = ceiling2( ui + 2hh, ui ); uir3 = ceiling2( -ui - 2hh, ui ); 247 printf( "ceiling2(%u, %u) = %u, ceiling2(%u, %u) = %u, ceiling2(%u, %u) = %u\n", ui, ui, uir1, ui + 2h, ui, uir2, -ui - 2h, ui, uir3 ); 248 } // for 249 printf( "\n" ); 250 251 printf( "long int\n" ); 262 // printf( "ceiling2(%u, %u) = %u, ceiling2(%u, %u) = %u, ceiling2(%u, %u) = %u\n", ui, ui, uir1, ui + 2, ui, uir2, -ui - 2, ui, uir3 ); 263 sout | "ceiling2(" | ui | "," | ui | ") = " | uir1 | ", ceiling2(" | ui + 2 | "," | ui | ") = " | uir2 | ", ceiling2(" | -ui - 2 | "," | ui | ") = " | uir3; 264 } // for 265 sout | nl; 266 267 sout | "long int"; 252 268 for ( li = 1; li != 0; li <<= 1 ) { 253 269 lir1 = ceiling2( li, li ); lir2 = ceiling2( li + 2hh, li ); lir3 = ceiling2( -li - 2hh, li ); 254 printf( "ceiling2(%ld, %ld) = %ld, ceiling2(%ld, %ld) = %ld, ceiling2(%ld, %ld) = %ld\n", li, li, lir1, li + 2h, li, lir2, -li - 2h, li, lir3 ); 255 } // for 256 printf( "\n" ); 257 258 printf( "unsigned long int\n" ); 270 // printf( "ceiling2(%ld, %ld) = %ld, ceiling2(%ld, %ld) = %ld, ceiling2(%ld, %ld) = %ld\n", li, li, lir1, li + 2l, li, lir2, -li - 2l, li, lir3 ); 271 sout | "ceiling2(" | li | "," | li | ") = " | lir1 | ", ceiling2(" | li + 2l | "," | li | ") = " | lir2 | ", ceiling2(" | -li - 2l | "," | li | ") = " | lir3; 272 } // for 273 sout | nl; 274 275 sout | "unsigned long int"; 259 276 for ( uli = 1; uli != 0; uli <<= 1 ) { 260 277 ulir1 = ceiling2( uli, uli ); ulir2 = ceiling2( uli + 2hh, uli ); ulir3 = ceiling2( -uli - 2hh, uli ); 261 printf( "ceiling2(%lu, %lu) = %lu, ceiling2(%lu, %lu) = %lu, ceiling2(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2h, uli, ulir2, -uli - 2h, uli, ulir3 ); 262 } // for 263 printf( "\n" ); 264 265 printf( "long long int\n" ); 278 // printf( "ceiling2(%lu, %lu) = %lu, ceiling2(%lu, %lu) = %lu, ceiling2(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2, uli, ulir2, -uli - 2, uli, ulir3 ); 279 sout | "ceiling2(" | uli | "," | uli | ") = " | ulir1 | ", ceiling2(" | uli + 2l | "," | uli | ") = " | ulir2 | ", ceiling2(" | -uli - 2l | "," | uli | ") = " | ulir3; 280 } // for 281 sout | nl; 282 283 sout | "long long int"; 266 284 for ( lli = 1; lli != 0; lli <<= 1 ) { 267 285 llir1 = ceiling2( lli, lli ); llir2 = ceiling2( lli + 2hh, lli ); llir3 = ceiling2( -lli - 2hh, lli ); 268 printf( "ceiling2(%lld, %lld) = %lld, ceiling2(%lld, %lld) = %lld, ceiling2(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2h, lli, llir2, -lli - 2h, lli, llir3 ); 269 } // for 270 printf( "\n" ); 271 272 printf( "unsigned long long int\n" ); 286 // printf( "ceiling2(%lld, %lld) = %lld, ceiling2(%lld, %lld) = %lld, ceiling2(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2ll, lli, llir2, -lli - 2ll, lli, llir3 ); 287 sout | "ceiling2(" | lli | "," | lli | ") = " | llir1 | ", ceiling2(" | lli + 2ll | "," | lli | ") = " | llir2 | ", ceiling2(" | -lli - 2ll | "," | lli | ") = " | llir3; 288 } // for 289 sout | nl; 290 291 sout | "unsigned long long int"; 273 292 for ( ulli = 1; ulli != 0; ulli <<= 1 ) { 274 293 ullir1 = ceiling2( ulli, ulli ); ullir2 = ceiling2( ulli + 2hh, ulli ); ullir3 = ceiling2( -ulli - 2hh, ulli ); 275 printf( "ceiling2(%llu, %llu) = %llu, ceiling2(%llu, %llu) = %llu, ceiling2(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 ); 276 } // for 277 printf( "\n" ); 294 // printf( "ceiling2(%llu, %llu) = %llu, ceiling2(%llu, %llu) = %llu, ceiling2(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 ); 295 sout | "ceiling2(" | ulli | "," | ulli | ") = " | ullir1 | ", ceiling2(" | ulli + 2ll | "," | ulli | ") = " | ullir2 | ", ceiling2(" | -ulli - 2ll | "," | ulli | ") = " | ullir3; 296 } // for 297 sout | nl; 278 298 #endif // 0 279 299 } // main -
tests/mathX.cfa
rea54f1e r4f89e7b 10 10 // Created On : Thu May 24 20:56:54 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Feb 20 18:26:38202113 // Update Count : 3 012 // Last Modified On : Sun Aug 8 22:33:46 2021 13 // Update Count : 31 14 14 // 15 15 … … 255 255 sout | "ceiling(" | ulli | ", " | ulli | ") = " | ullir1 | ", ceiling(" | ulli + 2ull | ", " | ulli | ") = " | ullir2 | ", ceiling(" | -ulli - 2ull | ", " | ulli | ") = " | ullir3; 256 256 } // for 257 printf( "\n" );257 sout | nl; 258 258 #endif // 0 259 259 } // main
Note: See TracChangeset
for help on using the changeset viewer.