Ignore:
Timestamp:
Aug 24, 2020, 8:34:24 PM (14 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
0254454
Parents:
97cba9f
Message:

move routines floor, ceiling, ceiling_div from bitmanip.hfa to math.hfa

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/bitmanip3.cfa

    r97cba9f r7cfef0d  
    1010// Created On       : Tue Apr  7 21:22:59 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 10 09:31:35 2020
    13 // Update Count     : 65
     12// Last Modified On : Mon Aug 24 09:53:26 2020
     13// Update Count     : 66
    1414//
    1515
     
    134134
    135135        printf( "signed char\n" );
    136 //      sc = 0;
    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 );
    139136        for ( sc = 1; sc != 0; sc <<= 1 ) {
    140137                scr1 = floor2( sc, sc ); scr2 = floor2( sc + 2hh, sc ); scr3 = floor2( -sc - 2hh, sc );
     
    144141
    145142        printf( "unsigned char\n" );
    146 //      uc = 0;
    147 //      ucr1 = floor2( uc, uc ), ucr2 = floor2( uc + 2hh, uc ), ucr3 = floor2( -uc - 2hh, uc );
    148 //      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 );
    149143        for ( uc = 1; uc != 0; uc <<= 1 ) {
    150144                ucr1 = floor2( uc, uc ); ucr2 = floor2( uc + 2hh, uc ); ucr3 = floor2( -uc - 2hh, uc );
     
    154148
    155149        printf( "short int\n" );
    156 //      si = 0;
    157 //      sir1 = floor2( si, si ), sir2 = floor2( si + 2hh, si ), sir3 = floor2( -si - 2hh, si );
    158 //      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 );
    159150        for ( si = 1; si != 0; si <<= 1 ) {
    160151                sir1 = floor2( si, si ); sir2 = floor2( si + 2hh, si ); sir3 = floor2( -si - 2hh, si );
     
    164155
    165156        printf( "unsigned short int\n" );
    166 //      usi = 0;
    167 //      usir1 = floor2( usi, usi ), usir2 = floor2( usi + 2hh, usi ), usir3 = floor2( -usi - 2hh, usi );
    168 //      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 );
    169157        for ( usi = 1; usi != 0; usi <<= 1 ) {
    170158                usir1 = floor2( usi, usi ); usir2 = floor2( usi + 2hh, usi ); usir3 = floor2( -usi - 2hh, usi );
     
    174162
    175163        printf( "int\n" );
    176 //      i = 0;
    177 //      ir1 = floor2( i, i ), ir2 = floor2( i + 2hh, i ), ir3 = floor2( -i - 2hh, i );
    178 //      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 );
    179164        for ( i = 1; i != 0; i <<= 1 ) {
    180165                ir1 = floor2( i, i ); ir2 = floor2( i + 2hh, i ); ir3 = floor2( -i - 2hh, i );
     
    184169
    185170        printf( "unsigned int\n" );
    186 //      ui = 0;
    187 //      uir1 = floor2( ui, ui ), uir2 = floor2( ui + 2hh, ui ), uir3 = floor2( -ui - 2hh, ui );
    188 //      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 );
    189171        for ( ui = 1; ui != 0; ui <<= 1 ) {
    190172                uir1 = floor2( ui, ui ); uir2 = floor2( ui + 2hh, ui ); uir3 = floor2( -ui - 2hh, ui );
     
    194176
    195177        printf( "long int\n" );
    196 //      li = 0;
    197 //      lir1 = floor2( li, li ), lir2 = floor2( li + 2hh, li ), lir3 = floor2( -li - 2hh, li );
    198 //      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 );
    199178        for ( li = 1; li != 0; li <<= 1 ) {
    200179                lir1 = floor2( li, li ); lir2 = floor2( li + 2hh, li ); lir3 = floor2( -li - 2hh, li );
     
    204183
    205184        printf( "unsigned long int\n" );
    206 //      uli = 0;
    207 //      ulir1 = floor2( uli, uli ), ulir2 = floor2( uli + 2hh, uli ), ulir3 = floor2( -uli - 2hh, uli );
    208 //      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 );
    209185        for ( uli = 1; uli != 0; uli <<= 1 ) {
    210186                ulir1 = floor2( uli, uli ); ulir2 = floor2( uli + 2hh, uli ); ulir3 = floor2( -uli - 2hh, uli );
     
    214190
    215191        printf( "long long int\n" );
    216 //      lli = 0;
    217 //      llir1 = floor2( lli, lli ), llir2 = floor2( lli + 2hh, lli ), llir3 = floor2( -lli - 2hh, lli );
    218 //      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 );
    219192        for ( lli = 1; lli != 0; lli <<= 1 ) {
    220193                llir1 = floor2( lli, lli ); llir2 = floor2( lli + 2hh, lli ); llir3 = floor2( -lli - 2hh, lli );
     
    224197
    225198        printf( "unsigned long long int\n" );
    226 //      ulli = 0;
    227 //      ullir1 = floor2( ulli, ulli ), ullir2 = floor2( ulli + 2hh, ulli ), ullir3 = floor2( -ulli - 2hh, ulli );
    228 //      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 );
    229199        for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
    230200                ullir1 = floor2( ulli, ulli ); ullir2 = floor2( ulli + 2hh, ulli ); ullir3 = floor2( -ulli - 2hh, ulli );
    231201                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 );
    232         } // for
    233         printf( "\n" );
    234 #endif // 0
    235         //============================================================
    236 #if 1
    237         sout | nl | "floor" | nl | nl;
    238 
    239         printf( "signed char\n" );
    240         for ( sc = 1; sc != 0; sc <<= 1 ) {
    241                 scr1 = floor( sc, sc ); scr2 = floor( sc + 2hh, sc ); scr3 = floor( -sc - 2hh, sc );
    242                 printf( "floor(%hhd, %hhd) = %hhd, floor(%hhd, %hhd) = %hhd, floor(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 );
    243         } // for
    244         printf( "\n" );
    245 
    246         printf( "unsigned char\n" );
    247         for ( uc = 1; uc != 0; uc <<= 1 ) {
    248                 ucr1 = floor( uc, uc ); ucr2 = floor( uc + 2hh, uc ); ucr3 = floor( -uc - 2hh, uc );
    249                 printf( "floor(%hhu, %hhu) = %hhu, floor(%hhu, %hhu) = %hhu, floor(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 );
    250         } // for
    251         printf( "\n" );
    252 
    253         printf( "short int\n" );
    254         for ( si = 1; si != 0; si <<= 1 ) {
    255                 sir1 = floor( si, si ); sir2 = floor( si + 2hh, si ); sir3 = floor( -si - 2hh, si );
    256                 printf( "floor(%hd, %hd) = %hd, floor(%hd, %hd) = %hd, floor(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 );
    257         } // for
    258         printf( "\n" );
    259 
    260         printf( "unsigned short int\n" );
    261         for ( usi = 1; usi != 0; usi <<= 1 ) {
    262                 usir1 = floor( usi, usi ); usir2 = floor( usi + 2hh, usi ); usir3 = floor( -usi - 2hh, usi );
    263                 printf( "floor(%hu, %hu) = %hu, floor(%hu, %hu) = %hu, floor(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 );
    264         } // for
    265         printf( "\n" );
    266 
    267         printf( "int\n" );
    268         for ( i = 1; i != 0; i <<= 1 ) {
    269                 ir1 = floor( i, i ); ir2 = floor( i + 2hh, i ); ir3 = floor( -i - 2hh, i );
    270                 printf( "floor(%d, %d) = %d, floor(%d, %d) = %d, floor(%d, %d) = %d\n", i, i, ir1, i + 2h, i, ir2, -i - 2h, i, ir3 );
    271         } // for
    272         printf( "\n" );
    273 
    274         printf( "unsigned int\n" );
    275         for ( ui = 1; ui != 0; ui <<= 1 ) {
    276                 uir1 = floor( ui, ui ); uir2 = floor( ui + 2hh, ui ); uir3 = floor( -ui - 2hh, ui );
    277                 printf( "floor(%u, %u) = %u, floor(%u, %u) = %u, floor(%u, %u) = %u\n", ui, ui, uir1, ui + 2h, ui, uir2, -ui - 2h, ui, uir3 );
    278         } // for
    279         printf( "\n" );
    280 
    281         printf( "long int\n" );
    282         for ( li = 1; li != 0; li <<= 1 ) {
    283                 lir1 = floor( li, li ); lir2 = floor( li + 2hh, li ); lir3 = floor( -li - 2hh, li );
    284                 printf( "floor(%ld, %ld) = %ld, floor(%ld, %ld) = %ld, floor(%ld, %ld) = %ld\n", li, li, lir1, li + 2h, li, lir2, -li - 2h, li, lir3 );
    285         } // for
    286         printf( "\n" );
    287 
    288         printf( "unsigned long int\n" );
    289         for ( uli = 1; uli != 0; uli <<= 1 ) {
    290                 ulir1 = floor( uli, uli ); ulir2 = floor( uli + 2hh, uli ); ulir3 = floor( -uli - 2hh, uli );
    291                 printf( "floor(%lu, %lu) = %lu, floor(%lu, %lu) = %lu, floor(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2h, uli, ulir2, -uli - 2h, uli, ulir3 );
    292         } // for
    293         printf( "\n" );
    294 
    295         printf( "long long int\n" );
    296         for ( lli = 1; lli != 0; lli <<= 1 ) {
    297                 llir1 = floor( lli, lli ); llir2 = floor( lli + 2hh, lli ); llir3 = floor( -lli - 2hh, lli );
    298                 printf( "floor(%lld, %lld) = %lld, floor(%lld, %lld) = %lld, floor(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2h, lli, llir2, -lli - 2h, lli, llir3 );
    299         } // for
    300         printf( "\n" );
    301 
    302         printf( "unsigned long long int\n" );
    303         for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
    304                 ullir1 = floor( ulli, ulli ); ullir2 = floor( ulli + 2hh, ulli ); ullir3 = floor( -ulli - 2hh, ulli );
    305                 printf( "floor(%llu, %llu) = %llu, floor(%llu, %llu) = %llu, floor(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 );
    306202        } // for
    307203        printf( "\n" );
     
    312208
    313209        printf( "signed char\n" );
    314 //      sc = 0;
    315 //      scr1 = ceiling2( sc, sc ), scr2 = ceiling2( sc + 2hh, sc ), scr3 = ceiling2( -sc - 2hh, sc );
    316 //      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 );
    317210        for ( sc = 1; sc != 0; sc <<= 1 ) {
    318211                scr1 = ceiling2( sc, sc ); scr2 = ceiling2( sc + 2hh, sc ); scr3 = ceiling2( -sc - 2hh, sc );
     
    322215
    323216        printf( "unsigned char\n" );
    324 //      uc = 0;
    325 //      ucr1 = ceiling2( uc, uc ), ucr2 = ceiling2( uc + 2hh, uc ), ucr3 = ceiling2( -uc - 2hh, uc );
    326 //      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 );
    327217        for ( uc = 1; uc != 0; uc <<= 1 ) {
    328218                ucr1 = ceiling2( uc, uc ); ucr2 = ceiling2( uc + 2hh, uc ); ucr3 = ceiling2( -uc - 2hh, uc );
     
    332222
    333223        printf( "short int\n" );
    334 //      si = 0;
    335 //      sir1 = ceiling2( si, si ), sir2 = ceiling2( si + 2hh, si ), sir3 = ceiling2( -si - 2hh, si );
    336 //      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 );
    337224        for ( si = 1; si != 0; si <<= 1 ) {
    338225                sir1 = ceiling2( si, si ); sir2 = ceiling2( si + 2hh, si ); sir3 = ceiling2( -si - 2hh, si );
     
    342229
    343230        printf( "unsigned short int\n" );
    344 //      usi = 0;
    345 //      usir1 = ceiling2( usi, usi ), usir2 = ceiling2( usi + 2hh, usi ), usir3 = ceiling2( -usi - 2hh, usi );
    346 //      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 );
    347231        for ( usi = 1; usi != 0; usi <<= 1 ) {
    348232                usir1 = ceiling2( usi, usi ); usir2 = ceiling2( usi + 2hh, usi ); usir3 = ceiling2( -usi - 2hh, usi );
     
    352236
    353237        printf( "int\n" );
    354 //      i = 0;
    355 //      ir1 = ceiling2( i, i ), ir2 = ceiling2( i + 2hh, i ), ir3 = ceiling2( -i - 2hh, i );
    356 //      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 );
    357238        for ( i = 1; i != 0; i <<= 1 ) {
    358239                ir1 = ceiling2( i, i ); ir2 = ceiling2( i + 2hh, i ); ir3 = ceiling2( -i - 2hh, i );
     
    362243
    363244        printf( "unsigned int\n" );
    364 //      ui = 0;
    365 //      uir1 = ceiling2( ui, ui ), uir2 = ceiling2( ui + 2hh, ui ), uir3 = ceiling2( -ui - 2hh, ui );
    366 //      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 );
    367245        for ( ui = 1; ui != 0; ui <<= 1 ) {
    368246                uir1 = ceiling2( ui, ui ); uir2 = ceiling2( ui + 2hh, ui ); uir3 = ceiling2( -ui - 2hh, ui );
     
    372250
    373251        printf( "long int\n" );
    374 //      li = 0;
    375 //      lir1 = ceiling2( li, li ), lir2 = ceiling2( li + 2hh, li ), lir3 = ceiling2( -li - 2hh, li );
    376 //      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 );
    377252        for ( li = 1; li != 0; li <<= 1 ) {
    378253                lir1 = ceiling2( li, li ); lir2 = ceiling2( li + 2hh, li ); lir3 = ceiling2( -li - 2hh, li );
     
    382257
    383258        printf( "unsigned long int\n" );
    384 //      uli = 0;
    385 //      ulir1 = ceiling2( uli, uli ), ulir2 = ceiling2( uli + 2hh, uli ), ulir3 = ceiling2( -uli - 2hh, uli );
    386 //      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 );
    387259        for ( uli = 1; uli != 0; uli <<= 1 ) {
    388260                ulir1 = ceiling2( uli, uli ); ulir2 = ceiling2( uli + 2hh, uli ); ulir3 = ceiling2( -uli - 2hh, uli );
     
    392264
    393265        printf( "long long int\n" );
    394 //      lli = 0;
    395 //      llir1 = ceiling2( lli, lli ), llir2 = ceiling2( lli + 2hh, lli ), llir3 = ceiling2( -lli - 2hh, lli );
    396 //      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 );
    397266        for ( lli = 1; lli != 0; lli <<= 1 ) {
    398267                llir1 = ceiling2( lli, lli ); llir2 = ceiling2( lli + 2hh, lli ); llir3 = ceiling2( -lli - 2hh, lli );
     
    402271
    403272        printf( "unsigned long long int\n" );
    404 //      ulli = 0;
    405 //      ullir1 = ceiling2( ulli, ulli ), ullir2 = ceiling2( ulli + 2hh, ulli ), ullir3 = ceiling2( -ulli - 2hh, ulli );
    406 //      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 );
    407273        for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
    408274                ullir1 = ceiling2( ulli, ulli ); ullir2 = ceiling2( ulli + 2hh, ulli ); ullir3 = ceiling2( -ulli - 2hh, ulli );
    409275                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 );
    410         } // for
    411         printf( "\n" );
    412 #endif // 0
    413         //============================================================
    414 #if 1
    415         sout | nl | "ceiling_div" | nl | nl;
    416 
    417         printf( "signed char\n" );
    418         for ( sc = 1; sc != 0; sc <<= 1 ) {
    419                 scr1 = ceiling_div( sc, sc ); scr2 = ceiling_div( sc + 2hh, sc ); scr3 = ceiling_div( -sc - 2hh, sc );
    420                 printf( "ceiling_div(%hhd, %hhd) = %hhd, ceiling_div(%hhd, %hhd) = %hhd, ceiling_div(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 );
    421         } // for
    422         printf( "\n" );
    423 
    424         printf( "unsigned char\n" );
    425         for ( uc = 1; uc != 0; uc <<= 1 ) {
    426                 ucr1 = ceiling_div( uc, uc ); ucr2 = ceiling_div( uc + 2hh, uc ); ucr3 = ceiling_div( -uc - 2hh, uc );
    427                 printf( "ceiling_div(%hhu, %hhu) = %hhu, ceiling_div(%hhu, %hhu) = %hhu, ceiling_div(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 );
    428         } // for
    429         printf( "\n" );
    430 
    431         printf( "short int\n" );
    432         for ( si = 1; si != 0; si <<= 1 ) {
    433                 sir1 = ceiling_div( si, si ); sir2 = ceiling_div( si + 2hh, si ); sir3 = ceiling_div( -si - 2hh, si );
    434                 printf( "ceiling_div(%hd, %hd) = %hd, ceiling_div(%hd, %hd) = %hd, ceiling_div(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 );
    435         } // for
    436         printf( "\n" );
    437 
    438         printf( "unsigned short int\n" );
    439         for ( usi = 1; usi != 0; usi <<= 1 ) {
    440                 usir1 = ceiling_div( usi, usi ); usir2 = ceiling_div( usi + 2hh, usi ); usir3 = ceiling_div( -usi - 2hh, usi );
    441                 printf( "ceiling_div(%hu, %hu) = %hu, ceiling_div(%hu, %hu) = %hu, ceiling_div(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 );
    442         } // for
    443         printf( "\n" );
    444 
    445         printf( "int\n" );
    446         for ( i = 1; i != 0; i <<= 1 ) {
    447                 ir1 = ceiling_div( i, i ); ir2 = ceiling_div( i + 2hh, i ); ir3 = ceiling_div( -i - 2hh, i );
    448                 printf( "ceiling_div(%d, %d) = %d, ceiling_div(%d, %d) = %d, ceiling_div(%d, %d) = %d\n", i, i, ir1, i + 2h, i, ir2, -i - 2h, i, ir3 );
    449         } // for
    450         printf( "\n" );
    451 
    452         printf( "unsigned int\n" );
    453         for ( ui = 1; ui != 0; ui <<= 1 ) {
    454                 uir1 = ceiling_div( ui, ui ); uir2 = ceiling_div( ui + 2hh, ui ); uir3 = ceiling_div( -ui - 2hh, ui );
    455                 printf( "ceiling_div(%u, %u) = %u, ceiling_div(%u, %u) = %u, ceiling_div(%u, %u) = %u\n", ui, ui, uir1, ui + 2h, ui, uir2, -ui - 2h, ui, uir3 );
    456         } // for
    457         printf( "\n" );
    458 
    459         printf( "long int\n" );
    460         for ( li = 1; li != 0; li <<= 1 ) {
    461                 lir1 = ceiling_div( li, li ); lir2 = ceiling_div( li + 2hh, li ); lir3 = ceiling_div( -li - 2hh, li );
    462                 printf( "ceiling_div(%ld, %ld) = %ld, ceiling_div(%ld, %ld) = %ld, ceiling_div(%ld, %ld) = %ld\n", li, li, lir1, li + 2h, li, lir2, -li - 2h, li, lir3 );
    463         } // for
    464         printf( "\n" );
    465 
    466         printf( "unsigned long int\n" );
    467         for ( uli = 1; uli != 0; uli <<= 1 ) {
    468                 ulir1 = ceiling_div( uli, uli ); ulir2 = ceiling_div( uli + 2hh, uli ); ulir3 = ceiling_div( -uli - 2hh, uli );
    469                 printf( "ceiling_div(%lu, %lu) = %lu, ceiling_div(%lu, %lu) = %lu, ceiling_div(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2h, uli, ulir2, -uli - 2h, uli, ulir3 );
    470         } // for
    471         printf( "\n" );
    472 
    473         printf( "long long int\n" );
    474         for ( lli = 1; lli != 0; lli <<= 1 ) {
    475                 llir1 = ceiling_div( lli, lli ); llir2 = ceiling_div( lli + 2hh, lli ); llir3 = ceiling_div( -lli - 2hh, lli );
    476                 printf( "ceiling_div(%lld, %lld) = %lld, ceiling_div(%lld, %lld) = %lld, ceiling_div(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2h, lli, llir2, -lli - 2h, lli, llir3 );
    477         } // for
    478         printf( "\n" );
    479 
    480         printf( "unsigned long long int\n" );
    481         for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
    482                 ullir1 = ceiling_div( ulli, ulli ); ullir2 = ceiling_div( ulli + 2hh, ulli ); ullir3 = ceiling_div( -ulli - 2hh, ulli );
    483                 printf( "ceiling_div(%llu, %llu) = %llu, ceiling_div(%llu, %llu) = %llu, ceiling_div(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 );
    484         } // for
    485         printf( "\n" );
    486 #endif // 0
    487         //============================================================
    488 #if 1
    489         sout | nl | "ceiling" | nl | nl;
    490 
    491         printf( "signed char\n" );
    492         for ( sc = 1; sc != 0; sc <<= 1 ) {
    493                 scr1 = ceiling( sc, sc ); scr2 = ceiling( sc + 2hh, sc ); scr3 = ceiling( -sc - 2hh, sc );
    494                 printf( "ceiling(%hhd, %hhd) = %hhd, ceiling(%hhd, %hhd) = %hhd, ceiling(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 );
    495         } // for
    496         printf( "\n" );
    497 
    498         printf( "unsigned char\n" );
    499         for ( uc = 1; uc != 0; uc <<= 1 ) {
    500                 ucr1 = ceiling( uc, uc ); ucr2 = ceiling( uc + 2hh, uc ); ucr3 = ceiling( -uc - 2hh, uc );
    501                 printf( "ceiling(%hhu, %hhu) = %hhu, ceiling(%hhu, %hhu) = %hhu, ceiling(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 );
    502         } // for
    503         printf( "\n" );
    504 
    505         printf( "short int\n" );
    506         for ( si = 1; si != 0; si <<= 1 ) {
    507                 sir1 = ceiling( si, si ); sir2 = ceiling( si + 2hh, si ); sir3 = ceiling( -si - 2hh, si );
    508                 printf( "ceiling(%hd, %hd) = %hd, ceiling(%hd, %hd) = %hd, ceiling(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 );
    509         } // for
    510         printf( "\n" );
    511 
    512         printf( "unsigned short int\n" );
    513         for ( usi = 1; usi != 0; usi <<= 1 ) {
    514                 usir1 = ceiling( usi, usi ); usir2 = ceiling( usi + 2hh, usi ); usir3 = ceiling( -usi - 2hh, usi );
    515                 printf( "ceiling(%hu, %hu) = %hu, ceiling(%hu, %hu) = %hu, ceiling(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 );
    516         } // for
    517         printf( "\n" );
    518 
    519         printf( "int\n" );
    520         for ( i = 1; i != 0; i <<= 1 ) {
    521                 ir1 = ceiling( i, i ); ir2 = ceiling( i + 2hh, i ); ir3 = ceiling( -i - 2hh, i );
    522                 printf( "ceiling(%d, %d) = %d, ceiling(%d, %d) = %d, ceiling(%d, %d) = %d\n", i, i, ir1, i + 2h, i, ir2, -i - 2h, i, ir3 );
    523         } // for
    524         printf( "\n" );
    525 
    526         printf( "unsigned int\n" );
    527         for ( ui = 1; ui != 0; ui <<= 1 ) {
    528                 uir1 = ceiling( ui, ui ); uir2 = ceiling( ui + 2hh, ui ); uir3 = ceiling( -ui - 2hh, ui );
    529                 printf( "ceiling(%u, %u) = %u, ceiling(%u, %u) = %u, ceiling(%u, %u) = %u\n", ui, ui, uir1, ui + 2h, ui, uir2, -ui - 2h, ui, uir3 );
    530         } // for
    531         printf( "\n" );
    532 
    533         printf( "long int\n" );
    534         for ( li = 1; li != 0; li <<= 1 ) {
    535                 lir1 = ceiling( li, li ); lir2 = ceiling( li + 2hh, li ); lir3 = ceiling( -li - 2hh, li );
    536                 printf( "ceiling(%ld, %ld) = %ld, ceiling(%ld, %ld) = %ld, ceiling(%ld, %ld) = %ld\n", li, li, lir1, li + 2h, li, lir2, -li - 2h, li, lir3 );
    537         } // for
    538         printf( "\n" );
    539 
    540         printf( "unsigned long int\n" );
    541         for ( uli = 1; uli != 0; uli <<= 1 ) {
    542                 ulir1 = ceiling( uli, uli ); ulir2 = ceiling( uli + 2hh, uli ); ulir3 = ceiling( -uli - 2hh, uli );
    543                 printf( "ceiling(%lu, %lu) = %lu, ceiling(%lu, %lu) = %lu, ceiling(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2h, uli, ulir2, -uli - 2h, uli, ulir3 );
    544         } // for
    545         printf( "\n" );
    546 
    547         printf( "long long int\n" );
    548         for ( lli = 1; lli != 0; lli <<= 1 ) {
    549                 llir1 = ceiling( lli, lli ); llir2 = ceiling( lli + 2hh, lli ); llir3 = ceiling( -lli - 2hh, lli );
    550                 printf( "ceiling(%lld, %lld) = %lld, ceiling(%lld, %lld) = %lld, ceiling(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2h, lli, llir2, -lli - 2h, lli, llir3 );
    551         } // for
    552         printf( "\n" );
    553 
    554         printf( "unsigned long long int\n" );
    555         for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
    556                 ullir1 = ceiling( ulli, ulli ); ullir2 = ceiling( ulli + 2hh, ulli ); ullir3 = ceiling( -ulli - 2hh, ulli );
    557                 printf( "ceiling(%llu, %llu) = %llu, ceiling(%llu, %llu) = %llu, ceiling(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 );
    558276        } // for
    559277        printf( "\n" );
Note: See TracChangeset for help on using the changeset viewer.