source: tests/bitmanip3.cfa@ da36d25

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since da36d25 was da36d25, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

first complete draft of bitmanip, performance problems with polymorphic functions

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