source: tests/bitmanip3.cfa@ 82a5ea2

Last change on this file since 82a5ea2 was 4f89e7b, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

more change printf to sout

  • Property mode set to 100644
File size: 14.9 KB
RevLine 
[da36d25]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
[4f89e7b]12// Last Modified On : Sun Aug 8 23:12:19 2021
13// Update Count : 76
[da36d25]14//
15
16#include <fstream.hfa>
17#include <bitmanip.hfa>
18
19int main() {
[21923bd]20 bool b1, b2;
21 signed char sc, scr1, scr2, scr3;
22 unsigned char uc, ucr1, ucr2, ucr3;
23 short int si, sir1, sir2, sir3;
24 unsigned short int usi, usir1, usir2, usir3;
25 int i, ir1, ir2, ir3;
26 unsigned int ui, uir1, uir2, uir3;
27 long int li, lir1, lir2, lir3;
28 unsigned long int uli, ulir1, ulir2, ulir3;
29 long long int lli, llir1, llir2, llir3;
30 unsigned long long int ulli, ullir1, ullir2, ullir3;
[da36d25]31
32 //============================================================
33#if 1
34 sout | nl | "is_pow2" | nl | nl;
35
36 sout | "signed char";
37 sc = 0;
[21923bd]38 b1 = is_pow2( sc ), b2 = is_pow2( sc + 13hh );
39 sout | wd(__bitsizeof(sc)+2, pad0(bin(sc))) | b1 | wd(__bitsizeof(sc)+2, pad0(bin(sc + 13hh))) | b2;
[da36d25]40 for ( sc = 1; sc != 0; sc <<= 1 ) {
[21923bd]41 b1 = is_pow2( sc ), b2 = is_pow2( sc + 13hh );
42 sout | wd(__bitsizeof(sc)+2, pad0(bin(sc))) | b1 | wd(__bitsizeof(sc)+2, pad0(bin(sc + 13hh))) | b2;
[da36d25]43 } // for
44 sout | nl;
45 sout | "unsigned char";
[21923bd]46 uc = 0;
47 b1 = is_pow2( uc ), b2 = is_pow2( uc + 13hh );
48 sout | wd(__bitsizeof(uc)+2, pad0(bin(uc))) | b1 | wd(__bitsizeof(uc)+2, pad0(bin(uc + 13hh))) | b2;
49 for ( uc = 1; uc != 0; uc <<= 1 ) {
50 b1 = is_pow2( uc ), b2 = is_pow2( uc + 13hh );
51 sout | wd(__bitsizeof(uc)+2, pad0(bin(uc))) | b1 | wd(__bitsizeof(uc)+2, pad0(bin(uc + 13hh))) | b2;
[da36d25]52 } // for
53 sout | nl;
54
55 sout | "short int";
56 si = 0;
[21923bd]57 b1 = is_pow2( si ), b2 = is_pow2( si + 13hh );
58 sout | wd(__bitsizeof(si)+2, pad0(bin(si))) | b1 | wd(__bitsizeof(si)+2, pad0(bin(si + 13h))) | b2;
[da36d25]59 for ( si = 1; si != 0; si <<= 1 ) {
[21923bd]60 b1 = is_pow2( si ), b2 = is_pow2( si + 13hh );
61 sout | wd(__bitsizeof(si)+2, pad0(bin(si))) | b1 | wd(__bitsizeof(si)+2, pad0(bin(si + 13h))) | b2;
[da36d25]62 } // for
63 sout | nl;
64 sout | "unsigned short int";
65 usi = 0;
[21923bd]66 b1 = is_pow2( usi ), b2 = is_pow2( usi + 13hh );
67 sout | wd(__bitsizeof(usi)+2, pad0(bin(usi))) | b1 | wd(__bitsizeof(usi)+2, pad0(bin(usi + 13hh))) | b2;
[da36d25]68 for ( usi = 1; usi != 0; usi <<= 1 ) {
[21923bd]69 b1 = is_pow2( usi ), b2 = is_pow2( usi + 13hh );
70 sout | wd(__bitsizeof(usi)+2, pad0(bin(usi))) | b1 | wd(__bitsizeof(usi)+2, pad0(bin(usi + 13hh))) | b2;
[da36d25]71 } // for
72 sout | nl;
73
74 sout | "int";
75 i = 0;
[21923bd]76 b1 = is_pow2( i ), b2 = is_pow2( i + 13hh );
77 sout | wd(__bitsizeof(i)+2, pad0(bin(i))) | b1 | wd(__bitsizeof(i)+2, pad0(bin(i + 13h))) | b2;
[da36d25]78 for ( i = 1; i != 0; i <<= 1 ) {
[21923bd]79 b1 = is_pow2( i ), b2 = is_pow2( i + 13hh );
80 sout | wd(__bitsizeof(i)+2, pad0(bin(i))) | b1 | wd(__bitsizeof(i)+2, pad0(bin(i + 13h))) | b2;
[da36d25]81 } // for
82 sout | nl;
83 sout | "unsigned int";
84 ui = 0;
[21923bd]85 b1 = is_pow2( ui ), b2 = is_pow2( ui + 13hh );
86 sout | wd(__bitsizeof(ui)+2, pad0(bin(ui))) | b1 | wd(__bitsizeof(ui)+2, pad0(bin(ui + 13hh))) | b2;
[da36d25]87 for ( ui = 1; ui != 0; ui <<= 1 ) {
[21923bd]88 b1 = is_pow2( ui ), b2 = is_pow2( ui + 13hh );
89 sout | wd(__bitsizeof(ui)+2, pad0(bin(ui))) | b1 | wd(__bitsizeof(ui)+2, pad0(bin(ui + 13hh))) | b2;
[da36d25]90 } // for
91 sout | nl;
92
93 sout | "long int";
94 li = 0;
[21923bd]95 b1 = is_pow2( li ), b2 = is_pow2( li + 13hh );
96 sout | wd(__bitsizeof(li)+2, pad0(bin(li))) | b1 | wd(__bitsizeof(li)+2, pad0(bin(li + 13h))) | b2;
[da36d25]97 for ( li = 1; li != 0; li <<= 1 ) {
[21923bd]98 b1 = is_pow2( li ), b2 = is_pow2( li + 13hh );
99 sout | wd(__bitsizeof(li)+2, pad0(bin(li))) | b1 | wd(__bitsizeof(li)+2, pad0(bin(li + 13h))) | b2;
[da36d25]100 } // for
101 sout | nl;
102 sout | "unsigned long int";
103 uli = 0;
[21923bd]104 b1 = is_pow2( uli ), b2 = is_pow2( uli + 13hh );
105 sout | wd(__bitsizeof(uli)+2, pad0(bin(uli))) | b1 | wd(__bitsizeof(uli)+2, pad0(bin(uli + 13h))) | b2;
[da36d25]106 for ( uli = 1; uli != 0; uli <<= 1 ) {
[21923bd]107 b1 = is_pow2( uli ), b2 = is_pow2( uli + 13hh );
108 sout | wd(__bitsizeof(uli)+2, pad0(bin(uli))) | b1 | wd(__bitsizeof(uli)+2, pad0(bin(uli + 13h))) | b2;
[da36d25]109 } // for
110 sout | nl;
111
112 sout | "long long int";
113 lli = 0;
[21923bd]114 b1 = is_pow2( lli ), b2 = is_pow2( lli + 13hh );
115 sout | wd(__bitsizeof(lli)+2, pad0(bin(lli))) | b1 | wd(__bitsizeof(lli)+2, pad0(bin(lli + 13h))) | b2;
[da36d25]116 for ( lli = 1; lli != 0; lli <<= 1 ) {
[21923bd]117 b1 = is_pow2( lli ), b2 = is_pow2( lli + 13hh );
118 sout | wd(__bitsizeof(lli)+2, pad0(bin(lli))) | b1 | wd(__bitsizeof(lli)+2, pad0(bin(lli + 13h))) | b2;
[da36d25]119 } // for
120 sout | nl;
121 sout | "unsigned long long int";
122 ulli = 0;
[21923bd]123 b1 = is_pow2( ulli ), b2 = is_pow2( ulli + 13hh );
124 sout | wd(__bitsizeof(ulli)+2, pad0(bin(ulli))) | b1 | wd(__bitsizeof(ulli)+2, pad0(bin(ulli + 13h))) | b2;
[da36d25]125 for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
[21923bd]126 b1 = is_pow2( ulli ), b2 = is_pow2( ulli + 13hh );
127 sout | wd(__bitsizeof(ulli)+2, pad0(bin(ulli))) | b1 | wd(__bitsizeof(ulli)+2, pad0(bin(ulli + 13h))) | b2;
[da36d25]128 } // for
129 sout | nl;
130#endif // 0
131 //============================================================
132#if 1
133 sout | nl | "floor2" | nl | nl;
134
[4f89e7b]135 sout | "signed char";
[a3fab47]136 for ( sc = 1; sc != 0; sc <<= 1 ) {
[21923bd]137 scr1 = floor2( sc, sc ); scr2 = floor2( sc + 2hh, sc ); scr3 = floor2( -sc - 2hh, sc );
[4f89e7b]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;
[da36d25]140 } // for
[4f89e7b]141 sout | nl;
[da36d25]142
[4f89e7b]143 sout | "unsigned char";
[a3fab47]144 for ( uc = 1; uc != 0; uc <<= 1 ) {
[21923bd]145 ucr1 = floor2( uc, uc ); ucr2 = floor2( uc + 2hh, uc ); ucr3 = floor2( -uc - 2hh, uc );
[4f89e7b]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;
[da36d25]148 } // for
[4f89e7b]149 sout | nl;
[da36d25]150
[4f89e7b]151 sout | "short int";
[a3fab47]152 for ( si = 1; si != 0; si <<= 1 ) {
[21923bd]153 sir1 = floor2( si, si ); sir2 = floor2( si + 2hh, si ); sir3 = floor2( -si - 2hh, si );
[4f89e7b]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;
[da36d25]156 } // for
[4f89e7b]157 sout | nl;
[da36d25]158
[4f89e7b]159 sout | "unsigned short int";
[a3fab47]160 for ( usi = 1; usi != 0; usi <<= 1 ) {
[21923bd]161 usir1 = floor2( usi, usi ); usir2 = floor2( usi + 2hh, usi ); usir3 = floor2( -usi - 2hh, usi );
[4f89e7b]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;
[da36d25]164 } // for
[4f89e7b]165 sout | nl;
[da36d25]166
[4f89e7b]167 sout | "int";
[a3fab47]168 for ( i = 1; i != 0; i <<= 1 ) {
[21923bd]169 ir1 = floor2( i, i ); ir2 = floor2( i + 2hh, i ); ir3 = floor2( -i - 2hh, i );
[4f89e7b]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;
[da36d25]172 } // for
[4f89e7b]173 sout | nl;
[da36d25]174
[4f89e7b]175 sout | "unsigned int";
[a3fab47]176 for ( ui = 1; ui != 0; ui <<= 1 ) {
[21923bd]177 uir1 = floor2( ui, ui ); uir2 = floor2( ui + 2hh, ui ); uir3 = floor2( -ui - 2hh, ui );
[4f89e7b]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;
[da36d25]180 } // for
[4f89e7b]181 sout | nl;
[da36d25]182
[4f89e7b]183 sout | "long int";
[a3fab47]184 for ( li = 1; li != 0; li <<= 1 ) {
[21923bd]185 lir1 = floor2( li, li ); lir2 = floor2( li + 2hh, li ); lir3 = floor2( -li - 2hh, li );
[4f89e7b]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;
[da36d25]188 } // for
[4f89e7b]189 sout | nl;
[da36d25]190
[4f89e7b]191 sout | "unsigned long int";
[a3fab47]192 for ( uli = 1; uli != 0; uli <<= 1 ) {
[21923bd]193 ulir1 = floor2( uli, uli ); ulir2 = floor2( uli + 2hh, uli ); ulir3 = floor2( -uli - 2hh, uli );
[4f89e7b]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;
[da36d25]196 } // for
[4f89e7b]197 sout | nl;
[da36d25]198
[4f89e7b]199 sout | "long long int";
[a3fab47]200 for ( lli = 1; lli != 0; lli <<= 1 ) {
[21923bd]201 llir1 = floor2( lli, lli ); llir2 = floor2( lli + 2hh, lli ); llir3 = floor2( -lli - 2hh, lli );
[4f89e7b]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;
[da36d25]204 } // for
[4f89e7b]205 sout | nl;
[da36d25]206
[4f89e7b]207 sout | "unsigned long long int";
[a3fab47]208 for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
[21923bd]209 ullir1 = floor2( ulli, ulli ); ullir2 = floor2( ulli + 2hh, ulli ); ullir3 = floor2( -ulli - 2hh, ulli );
[4f89e7b]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;
[da36d25]212 } // for
[4f89e7b]213 sout | nl;
[da36d25]214#endif // 0
215 //============================================================
216#if 1
217 sout | nl | "ceiling2" | nl | nl;
218
[4f89e7b]219 sout | "signed char";
[a3fab47]220 for ( sc = 1; sc != 0; sc <<= 1 ) {
[21923bd]221 scr1 = ceiling2( sc, sc ); scr2 = ceiling2( sc + 2hh, sc ); scr3 = ceiling2( -sc - 2hh, sc );
[4f89e7b]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;
[da36d25]224 } // for
[4f89e7b]225 sout | nl;
[da36d25]226
[4f89e7b]227 sout | "unsigned char";
[a3fab47]228 for ( uc = 1; uc != 0; uc <<= 1 ) {
[21923bd]229 ucr1 = ceiling2( uc, uc ); ucr2 = ceiling2( uc + 2hh, uc ); ucr3 = ceiling2( -uc - 2hh, uc );
[4f89e7b]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;
[da36d25]232 } // for
[4f89e7b]233 sout | nl;
[da36d25]234
[4f89e7b]235 sout | "short int";
[a3fab47]236 for ( si = 1; si != 0; si <<= 1 ) {
[21923bd]237 sir1 = ceiling2( si, si ); sir2 = ceiling2( si + 2hh, si ); sir3 = ceiling2( -si - 2hh, si );
[4f89e7b]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;
[da36d25]240 } // for
[4f89e7b]241 sout | nl;
[da36d25]242
[4f89e7b]243 sout | "unsigned short int";
[a3fab47]244 for ( usi = 1; usi != 0; usi <<= 1 ) {
[21923bd]245 usir1 = ceiling2( usi, usi ); usir2 = ceiling2( usi + 2hh, usi ); usir3 = ceiling2( -usi - 2hh, usi );
[4f89e7b]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;
[da36d25]248 } // for
[4f89e7b]249 sout | nl;
[da36d25]250
[4f89e7b]251 sout | "int";
[a3fab47]252 for ( i = 1; i != 0; i <<= 1 ) {
[21923bd]253 ir1 = ceiling2( i, i ); ir2 = ceiling2( i + 2hh, i ); ir3 = ceiling2( -i - 2hh, i );
[4f89e7b]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;
[da36d25]256 } // for
[4f89e7b]257 sout | nl;
[da36d25]258
[4f89e7b]259 sout | "unsigned int";
[a3fab47]260 for ( ui = 1; ui != 0; ui <<= 1 ) {
[21923bd]261 uir1 = ceiling2( ui, ui ); uir2 = ceiling2( ui + 2hh, ui ); uir3 = ceiling2( -ui - 2hh, ui );
[4f89e7b]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;
[da36d25]264 } // for
[4f89e7b]265 sout | nl;
[da36d25]266
[4f89e7b]267 sout | "long int";
[a3fab47]268 for ( li = 1; li != 0; li <<= 1 ) {
[21923bd]269 lir1 = ceiling2( li, li ); lir2 = ceiling2( li + 2hh, li ); lir3 = ceiling2( -li - 2hh, li );
[4f89e7b]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;
[da36d25]272 } // for
[4f89e7b]273 sout | nl;
[da36d25]274
[4f89e7b]275 sout | "unsigned long int";
[a3fab47]276 for ( uli = 1; uli != 0; uli <<= 1 ) {
[21923bd]277 ulir1 = ceiling2( uli, uli ); ulir2 = ceiling2( uli + 2hh, uli ); ulir3 = ceiling2( -uli - 2hh, uli );
[4f89e7b]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;
[da36d25]280 } // for
[4f89e7b]281 sout | nl;
[da36d25]282
[4f89e7b]283 sout | "long long int";
[a3fab47]284 for ( lli = 1; lli != 0; lli <<= 1 ) {
[21923bd]285 llir1 = ceiling2( lli, lli ); llir2 = ceiling2( lli + 2hh, lli ); llir3 = ceiling2( -lli - 2hh, lli );
[4f89e7b]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;
[da36d25]288 } // for
[4f89e7b]289 sout | nl;
[da36d25]290
[4f89e7b]291 sout | "unsigned long long int";
[a3fab47]292 for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
[21923bd]293 ullir1 = ceiling2( ulli, ulli ); ullir2 = ceiling2( ulli + 2hh, ulli ); ullir3 = ceiling2( -ulli - 2hh, ulli );
[4f89e7b]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;
[da36d25]296 } // for
[4f89e7b]297 sout | nl;
[da36d25]298#endif // 0
299} // main
300
301// Local Variables: //
302// tab-width: 4 //
303// compile-command: "cfa bitmanip3.cfa" //
304// End: //
Note: See TracBrowser for help on using the repository browser.