1 | #include <fstream.hfa> |
---|
2 | #include "bitmanip.hfa" |
---|
3 | |
---|
4 | int main() { |
---|
5 | signed char sc; |
---|
6 | unsigned char usc; |
---|
7 | short int si; |
---|
8 | unsigned short int usi; |
---|
9 | int i; |
---|
10 | unsigned int ui; |
---|
11 | long int li; |
---|
12 | unsigned long int uli; |
---|
13 | long long int lli; |
---|
14 | unsigned long long int ulli; |
---|
15 | |
---|
16 | sout | nlOff; |
---|
17 | |
---|
18 | //============================================================ |
---|
19 | |
---|
20 | sout | "cl0" | nl; |
---|
21 | |
---|
22 | sc = 0; |
---|
23 | sout | sc | cl0( sc ) | ","; |
---|
24 | for ( sc = 1; sc != 0; sc <<= 1 ) { |
---|
25 | sout | sc | cl0( sc ) | ","; |
---|
26 | } |
---|
27 | sout | nl; |
---|
28 | usc = 0; |
---|
29 | sout | usc | cl0( usc ) | ","; |
---|
30 | for ( usc = 1; usc != 0; usc <<= 1 ) { |
---|
31 | sout | usc | cl0( usc ) | ","; |
---|
32 | } |
---|
33 | sout | nl; |
---|
34 | |
---|
35 | si = 0; |
---|
36 | sout | si | cl0( si ) | ","; |
---|
37 | for ( si = 1; si != 0; si <<= 1 ) { |
---|
38 | sout | si | cl0( si ) | ","; |
---|
39 | } |
---|
40 | sout | nl; |
---|
41 | usi = 0; |
---|
42 | sout | usi | cl0( usi ) | ","; |
---|
43 | for ( usi = 1; usi != 0; usi <<= 1 ) { |
---|
44 | sout | usi | cl0( usi ) | ","; |
---|
45 | } |
---|
46 | sout | nl; |
---|
47 | |
---|
48 | i = 0; |
---|
49 | sout | i | cl0( i ) | ","; |
---|
50 | for ( i = 1; i != 0; i <<= 1 ) { |
---|
51 | sout | i | cl0( i ) | ","; |
---|
52 | } |
---|
53 | sout | nl; |
---|
54 | ui = 0; |
---|
55 | sout | ui | cl0( ui ) | ","; |
---|
56 | for ( ui = 1; ui != 0; ui <<= 1 ) { |
---|
57 | sout | ui | cl0( ui ) | ","; |
---|
58 | } |
---|
59 | sout | nl; |
---|
60 | |
---|
61 | li = 0; |
---|
62 | sout | li | cl0( li ) | ","; |
---|
63 | for ( li = 1; li != 0; li <<= 1 ) { |
---|
64 | sout | li | cl0( li ) | ","; |
---|
65 | } |
---|
66 | sout | nl; |
---|
67 | uli = 0; |
---|
68 | sout | uli | cl0( uli ) | ","; |
---|
69 | for ( uli = 1; uli != 0; uli <<= 1 ) { |
---|
70 | sout | uli | cl0( uli ) | ","; |
---|
71 | } |
---|
72 | sout | nl; |
---|
73 | |
---|
74 | lli = 0; |
---|
75 | sout | lli | cl0( lli ) | ","; |
---|
76 | for ( lli = 1; lli != 0; lli <<= 1 ) { |
---|
77 | sout | lli | cl0( lli ) | ","; |
---|
78 | } |
---|
79 | sout | nl; |
---|
80 | ulli = 0; |
---|
81 | sout | ulli | cl0( ulli ) | ","; |
---|
82 | for ( ulli = 1; ulli != 0; ulli <<= 1 ) { |
---|
83 | sout | ulli | cl0( ulli ) | ","; |
---|
84 | } |
---|
85 | sout | nl; |
---|
86 | |
---|
87 | //============================================================ |
---|
88 | |
---|
89 | sout | nl | "ct0" | nl; |
---|
90 | |
---|
91 | sc = 0; |
---|
92 | sout | sc | ct0( sc ) | ","; |
---|
93 | for ( sc = 1; sc != 0; sc <<= 1 ) { |
---|
94 | sout | sc | ct0( sc ) | ","; |
---|
95 | } |
---|
96 | sout | nl; |
---|
97 | usc = 0; |
---|
98 | sout | usc | ct0( usc ) | ","; |
---|
99 | for ( usc = 1; usc != 0; usc <<= 1 ) { |
---|
100 | sout | usc | ct0( usc ) | ","; |
---|
101 | } |
---|
102 | sout | nl; |
---|
103 | |
---|
104 | si = 0; |
---|
105 | sout | si | ct0( si ) | ","; |
---|
106 | for ( si = 1; si != 0; si <<= 1 ) { |
---|
107 | sout | si | ct0( si ) | ","; |
---|
108 | } |
---|
109 | sout | nl; |
---|
110 | usi = 0; |
---|
111 | sout | usi | ct0( usi ) | ","; |
---|
112 | for ( usi = 1; usi != 0; usi <<= 1 ) { |
---|
113 | sout | usi | ct0( usi ) | ","; |
---|
114 | } |
---|
115 | sout | nl; |
---|
116 | |
---|
117 | i = 0; |
---|
118 | sout | i | ct0( i ) | ","; |
---|
119 | for ( i = 1; i != 0; i <<= 1 ) { |
---|
120 | sout | i | ct0( i ) | ","; |
---|
121 | } |
---|
122 | sout | nl; |
---|
123 | ui = 0; |
---|
124 | sout | ui | ct0( ui ) | ","; |
---|
125 | for ( ui = 1; ui != 0; ui <<= 1 ) { |
---|
126 | sout | ui | ct0( ui ) | ","; |
---|
127 | } |
---|
128 | sout | nl; |
---|
129 | |
---|
130 | li = 0; |
---|
131 | sout | li | ct0( li ) | ","; |
---|
132 | for ( li = 1; li != 0; li <<= 1 ) { |
---|
133 | sout | li | ct0( li ) | ","; |
---|
134 | } |
---|
135 | sout | nl; |
---|
136 | uli = 0; |
---|
137 | sout | uli | ct0( uli ) | ","; |
---|
138 | for ( uli = 1; uli != 0; uli <<= 1 ) { |
---|
139 | sout | uli | ct0( uli ) | ","; |
---|
140 | } |
---|
141 | sout | nl; |
---|
142 | |
---|
143 | lli = 0; |
---|
144 | sout | lli | ct0( lli ) | ","; |
---|
145 | for ( lli = 1; lli != 0; lli <<= 1 ) { |
---|
146 | sout | lli | ct0( lli ) | ","; |
---|
147 | } |
---|
148 | sout | nl; |
---|
149 | ulli = 0; |
---|
150 | sout | ulli | ct0( ulli ) | ","; |
---|
151 | for ( ulli = 1; ulli != 0; ulli <<= 1 ) { |
---|
152 | sout | ulli | ct0( ulli ) | ","; |
---|
153 | } |
---|
154 | sout | nl; |
---|
155 | |
---|
156 | //============================================================ |
---|
157 | |
---|
158 | sout | nl | "ca1" | nl; |
---|
159 | |
---|
160 | sc = 0; |
---|
161 | for ( int p = 0; p < sizeof(sc) * __CHAR_BIT__ + 1; p += 1, sc = (sc << 1) + 1 ) { |
---|
162 | sout | sc | ca1( sc ) | ","; |
---|
163 | } |
---|
164 | sout | nl; |
---|
165 | usc = 0; |
---|
166 | for ( int p = 0; p < sizeof(sc) * __CHAR_BIT__ + 1; p += 1, usc = (usc << 1) + 1 ) { |
---|
167 | sout | usc | ca1( usc ) | ","; |
---|
168 | } |
---|
169 | sout | nl; |
---|
170 | |
---|
171 | si = 0; |
---|
172 | for ( int p = 0; p < sizeof(si) * __CHAR_BIT__ + 1; p += 1, si = (si << 1) + 1 ) { |
---|
173 | sout | si | ca1( si ) | ","; |
---|
174 | } |
---|
175 | sout | nl; |
---|
176 | usi = 0; |
---|
177 | for ( int p = 0; p < sizeof(usi) * __CHAR_BIT__ + 1; p += 1, usi = (usi << 1) + 1 ) { |
---|
178 | sout | usi | ca1( usi ) | ","; |
---|
179 | } |
---|
180 | sout | nl; |
---|
181 | |
---|
182 | i = 0; |
---|
183 | for ( int p = 0; p < sizeof(i) * __CHAR_BIT__ + 1; p += 1, i = (i << 1) + 1 ) { |
---|
184 | sout | i | ca1( i ) | ","; |
---|
185 | } |
---|
186 | sout | nl; |
---|
187 | ui = 0; |
---|
188 | for ( int p = 0; p < sizeof(ui) * __CHAR_BIT__ + 1; p += 1, ui = (ui << 1) + 1 ) { |
---|
189 | sout | ui | ca1( ui ) | ","; |
---|
190 | } |
---|
191 | sout | nl; |
---|
192 | |
---|
193 | li = 0; |
---|
194 | for ( int p = 0; i < sizeof(li) * __CHAR_BIT__ + 1; p += 1, li = (li << 1) + 1 ) { |
---|
195 | sout | li | ca1( li ) | ","; |
---|
196 | } |
---|
197 | sout | nl; |
---|
198 | uli = 0; |
---|
199 | for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, uli = (uli << 1) + 1 ) { |
---|
200 | sout | uli | ca1( uli ) | ","; |
---|
201 | } |
---|
202 | sout | nl; |
---|
203 | |
---|
204 | lli = 0; |
---|
205 | for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, lli = (lli << 1) + 1 ) { |
---|
206 | sout | lli | ca1( lli ) | ","; |
---|
207 | } |
---|
208 | sout | nl; |
---|
209 | ulli = 0; |
---|
210 | for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, ulli = (ulli << 1) + 1 ) { |
---|
211 | sout | ulli | ca1( ulli ) | ","; |
---|
212 | } |
---|
213 | sout | nl; |
---|
214 | |
---|
215 | //============================================================ |
---|
216 | |
---|
217 | sout | nl | "ca0" | nl; |
---|
218 | |
---|
219 | sc = 0; |
---|
220 | for ( int p = 0; p < sizeof(sc) * __CHAR_BIT__ + 1; p += 1, sc = (sc << 1) + 1 ) { |
---|
221 | sout | sc | ca0( sc ) | ","; |
---|
222 | } |
---|
223 | sout | nl; |
---|
224 | usc = 0; |
---|
225 | for ( int p = 0; p < sizeof(sc) * __CHAR_BIT__ + 1; p += 1, usc = (usc << 1) + 1 ) { |
---|
226 | sout | usc | ca0( usc ) | ","; |
---|
227 | } |
---|
228 | sout | nl; |
---|
229 | |
---|
230 | si = 0; |
---|
231 | for ( int p = 0; p < sizeof(si) * __CHAR_BIT__ + 1; p += 1, si = (si << 1) + 1 ) { |
---|
232 | sout | si | ca0( si ) | ","; |
---|
233 | } |
---|
234 | sout | nl; |
---|
235 | usi = 0; |
---|
236 | for ( int p = 0; p < sizeof(si) * __CHAR_BIT__ + 1; p += 1, usi = (usi << 1) + 1 ) { |
---|
237 | sout | usi | ca0( usi ) | ","; |
---|
238 | } |
---|
239 | sout | nl; |
---|
240 | |
---|
241 | i = 0; |
---|
242 | for ( int p = 0; p < sizeof(i) * __CHAR_BIT__ + 1; p += 1, i = (i << 1) + 1 ) { |
---|
243 | sout | i | ca0( i ) | ","; |
---|
244 | } |
---|
245 | sout | nl; |
---|
246 | ui = 0; |
---|
247 | for ( int p = 0; p < sizeof(ui) * __CHAR_BIT__ + 1; p += 1, ui = (ui << 1) + 1 ) { |
---|
248 | sout | ui | ca0( ui ) | ","; |
---|
249 | } |
---|
250 | sout | nl; |
---|
251 | |
---|
252 | li = 0; |
---|
253 | for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, li = (li << 1) + 1 ) { |
---|
254 | sout | li | ca0( li ) | ","; |
---|
255 | } |
---|
256 | sout | nl; |
---|
257 | uli = 0; |
---|
258 | for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, uli = (uli << 1) + 1 ) { |
---|
259 | sout | uli | ca0( uli ) | ","; |
---|
260 | } |
---|
261 | sout | nl; |
---|
262 | |
---|
263 | lli = 0; |
---|
264 | for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, lli = (lli << 1) + 1 ) { |
---|
265 | sout | lli | ca0( lli ) | ","; |
---|
266 | } |
---|
267 | sout | nl; |
---|
268 | ulli = 0; |
---|
269 | for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, ulli = (ulli << 1) + 1 ) { |
---|
270 | sout | ulli | ca0( ulli ) | ","; |
---|
271 | } |
---|
272 | sout | nl; |
---|
273 | |
---|
274 | //============================================================ |
---|
275 | |
---|
276 | sout | nl | "fls" | nl; |
---|
277 | |
---|
278 | sc = 0; |
---|
279 | sout | sc | fls( sc ) | ","; |
---|
280 | for ( sc = 1; sc != 0; sc <<= 1 ) { |
---|
281 | sout | sc | fls( sc ) | ","; |
---|
282 | } |
---|
283 | sout | nl; |
---|
284 | usc = 0; |
---|
285 | sout | usc | fls( usc ) | ","; |
---|
286 | for ( usc = 1; usc != 0; usc <<= 1 ) { |
---|
287 | sout | usc | fls( usc ) | ","; |
---|
288 | } |
---|
289 | sout | nl; |
---|
290 | |
---|
291 | si = 0; |
---|
292 | sout | si | fls( si ) | ","; |
---|
293 | for ( si = 1; si != 0; si <<= 1 ) { |
---|
294 | sout | si | fls( si ) | ","; |
---|
295 | } |
---|
296 | sout | nl; |
---|
297 | usi = 0; |
---|
298 | sout | usi | fls( usi ) | ","; |
---|
299 | for ( usi = 1; usi != 0; usi <<= 1 ) { |
---|
300 | sout | usi | fls( usi ) | ","; |
---|
301 | } |
---|
302 | sout | nl; |
---|
303 | |
---|
304 | i = 0; |
---|
305 | sout | i | fls( i ) | ","; |
---|
306 | for ( i = 1; i != 0; i <<= 1 ) { |
---|
307 | sout | i | fls( i ) | ","; |
---|
308 | } |
---|
309 | sout | nl; |
---|
310 | ui = 0; |
---|
311 | sout | ui | fls( ui ) | ","; |
---|
312 | for ( ui = 1; ui != 0; ui <<= 1 ) { |
---|
313 | sout | ui | fls( ui ) | ","; |
---|
314 | } |
---|
315 | sout | nl; |
---|
316 | |
---|
317 | li = 0; |
---|
318 | sout | li | fls( li ) | ","; |
---|
319 | for ( li = 1; li != 0; li <<= 1 ) { |
---|
320 | sout | li | fls( li ) | ","; |
---|
321 | } |
---|
322 | sout | nl; |
---|
323 | uli = 0; |
---|
324 | sout | uli | fls( uli ) | ","; |
---|
325 | for ( uli = 1; uli != 0; uli <<= 1 ) { |
---|
326 | sout | uli | fls( uli ) | ","; |
---|
327 | } |
---|
328 | sout | nl; |
---|
329 | |
---|
330 | lli = 0; |
---|
331 | sout | lli | fls( lli ) | ","; |
---|
332 | for ( lli = 1; lli != 0; lli <<= 1 ) { |
---|
333 | sout | lli | fls( lli ) | ","; |
---|
334 | } |
---|
335 | sout | nl; |
---|
336 | ulli = 0; |
---|
337 | sout | ulli | fls( ulli ) | ","; |
---|
338 | for ( ulli = 1; ulli != 0; ulli <<= 1 ) { |
---|
339 | sout | ulli | fls( ulli ) | ","; |
---|
340 | } |
---|
341 | sout | nl; |
---|
342 | |
---|
343 | //============================================================ |
---|
344 | |
---|
345 | sout | nl | "fms" | nl; |
---|
346 | |
---|
347 | sc = 0; |
---|
348 | sout | sc | fms( sc ) | ","; |
---|
349 | for ( sc = 1; sc != 0; sc <<= 1 ) { |
---|
350 | sout | sc | fms( sc ) | ","; |
---|
351 | } |
---|
352 | sout | nl; |
---|
353 | usc = 0; |
---|
354 | sout | usc | fms( usc ) | ","; |
---|
355 | for ( usc = 1; usc != 0; usc <<= 1 ) { |
---|
356 | sout | usc | fms( usc ) | ","; |
---|
357 | } |
---|
358 | sout | nl; |
---|
359 | |
---|
360 | si = 0; |
---|
361 | sout | si | fms( si ) | ","; |
---|
362 | for ( si = 1; si != 0; si <<= 1 ) { |
---|
363 | sout | si | fms( si ) | ","; |
---|
364 | } |
---|
365 | sout | nl; |
---|
366 | usi = 0; |
---|
367 | sout | usi | fms( usi ) | ","; |
---|
368 | for ( usi = 1; usi != 0; usi <<= 1 ) { |
---|
369 | sout | usi | fms( usi ) | ","; |
---|
370 | } |
---|
371 | sout | nl; |
---|
372 | |
---|
373 | i = 0; |
---|
374 | sout | i | fms( i ) | ","; |
---|
375 | for ( i = 1; i != 0; i <<= 1 ) { |
---|
376 | sout | i | fms( i ) | ","; |
---|
377 | } |
---|
378 | sout | nl; |
---|
379 | ui = 0; |
---|
380 | sout | ui | fms( ui ) | ","; |
---|
381 | for ( ui = 1; ui != 0; ui <<= 1 ) { |
---|
382 | sout | ui | fms( ui ) | ","; |
---|
383 | } |
---|
384 | sout | nl; |
---|
385 | |
---|
386 | li = 0; |
---|
387 | sout | li | fms( li ) | ","; |
---|
388 | for ( li = 1; li != 0; li <<= 1 ) { |
---|
389 | sout | li | fms( li ) | ","; |
---|
390 | } |
---|
391 | sout | nl; |
---|
392 | uli = 0; |
---|
393 | sout | uli | fms( uli ) | ","; |
---|
394 | for ( uli = 1; uli != 0; uli <<= 1 ) { |
---|
395 | sout | uli | fms( uli ) | ","; |
---|
396 | } |
---|
397 | sout | nl; |
---|
398 | |
---|
399 | lli = 0; |
---|
400 | sout | lli | fms( lli ) | ","; |
---|
401 | for ( lli = 1; lli != 0; lli <<= 1 ) { |
---|
402 | sout | lli | fms( lli ) | ","; |
---|
403 | } |
---|
404 | sout | nl; |
---|
405 | ulli = 0; |
---|
406 | sout | ulli | fms( ulli ) | ","; |
---|
407 | for ( ulli = 1; ulli != 0; ulli <<= 1 ) { |
---|
408 | sout | ulli | fms( ulli ) | ","; |
---|
409 | } |
---|
410 | sout | nl; |
---|
411 | #if 0 |
---|
412 | #endif // 0 |
---|
413 | } |
---|