Changeset 6d5b85a for libcfa/src
- Timestamp:
- Apr 22, 2020, 4:33:55 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b8c1307
- Parents:
- 1bcdeff (diff), 5d7e049 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r1bcdeff r6d5b85a 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 11 14:35:35202013 // Update Count : 86012 // Last Modified On : Wed Apr 22 10:50:46 2020 13 // Update Count : 933 14 14 // 15 15 … … 29 29 #include <complex.h> // creal, cimag 30 30 } // extern "C" 31 32 #include <bitmanip.hfa> // fms 31 33 32 34 … … 459 461 \ 460 462 if ( f.base == 'b' || f.base == 'B' ) { /* bespoke binary format */ \ 461 int bits; \ 462 if ( f.val == (T){0} ) bits = 1; /* force at least one bit to print */ \ 463 else bits = sizeof(long long int) * 8 - __builtin_clzll( f.val ); /* position of most significant bit */ \ 464 bits = bits > sizeof(f.val) * 8 ? sizeof(f.val) * 8 : bits; \ 463 int bits = high1( f.val ); /* position of most significant bit */ \ 464 if ( bits == 0 ) bits = 1; /* 0 value => force one bit to print */ \ 465 465 int spaces = f.wd - bits; /* can be negative */ \ 466 466 if ( ! f.flags.nobsdp ) { spaces -= 2; } /* base prefix takes space */ \ … … 565 565 fmt2.flags.pad0 = fmt2.flags.nobsdp = true; \ 566 566 if ( f.base == 'b' | f.base == 'B' ) { \ 567 if ( f.wd > 64 ) fmt.wd = f.wd - 64; \ 568 if ( f.flags.pc && f.pc > 64 ) fmt.pc = f.pc - 64; \ 569 fmt2.wd = 64; \ 567 if ( fmt.flags.pc && fmt.pc > 64 ) fmt.pc -= 64; \ 568 if ( fmt.flags.left ) { \ 569 fmt2.wd = fmt.wd; \ 570 if ( fmt2.wd <= 64 ) { \ 571 fmt2.wd = 64; \ 572 } else { \ 573 if ( fmt.pc > 0 ) { \ 574 fmt2.wd -= fmt.pc; \ 575 } else { \ 576 fmt2.wd = fmt.wd - high1( msig ); \ 577 } /* if */ \ 578 if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \ 579 if ( fmt2.wd < 0 ) fmt2.wd = 0; \ 580 fmt2.flags.left = true; \ 581 fmt.wd = 0; \ 582 } /* if */ \ 583 printf( "left %d %d %x\n", f.wd, f.pc, f.all ); \ 584 printf( "left %d %d %x\n", fmt.wd, fmt.pc, fmt.all ); \ 585 } else { \ 586 fmt2.wd = 64; \ 587 if ( fmt.wd > 64 ) fmt.wd -= 64; \ 588 printf( "left %d %d %x\n", f.wd, f.pc, f.all ); \ 589 printf( "left %d %d %x\n", fmt.wd, fmt.pc, fmt.all ); \ 590 } /* if */ \ 591 fmt2.pc = 64; fmt2.flags.pc = true; \ 592 printf( "left %d %d %x\n", fmt2.wd, fmt2.pc, fmt2.all ); \ 570 593 (ostype &)(os | fmt | "" | fmt2); \ 571 594 } else if ( f.base == 'o' ) { \ 572 fmt.val = (unsigned long long int)fmt.val >> 2; \ 573 if ( f.wd > 21 ) fmt.wd = f.wd - 21; \ 574 if ( f.flags.pc && f.pc > 21 ) fmt.pc = f.pc - 21; \ 575 fmt2.wd = 1; \ 576 fmt2.val = ((msig & 0x3) << 1) + 1; \ 577 (ostype &)(os | fmt | "" | fmt2); \ 578 sepOff( os ); \ 579 fmt2.wd = 21; \ 580 fmt2.val = lsig & 0x7fffffffffffffff; \ 581 (ostype &)(os | fmt2); \ 595 if ( fmt.flags.pc && fmt.pc > 21 ) fmt.pc -= 21; \ 596 if ( fmt.flags.left ) { \ 597 fmt.flags.left = false; \ 598 fmt.wd = 1; \ 599 fmt.val = (unsigned long long int)fmt.val >> 2; \ 600 fmt2.wd = 1; \ 601 fmt2.val = ((msig & 0x3) << 1) + 1; \ 602 (ostype &)(os | fmt | "" | fmt2); \ 603 sepOff( os ); \ 604 fmt2.flags.left = true; \ 605 fmt2.wd = f.wd - ( ceiling( high1( fmt.val ), 3 ) + 1 ); \ 606 fmt2.flags.pc = true; fmt2.pc = 21; \ 607 if ( ! fmt.flags.nobsdp ) { fmt2.wd -= 1; } \ 608 fmt2.val = lsig & 0x7fffffffffffffff; \ 609 (ostype &)(os | fmt2); \ 610 } else { \ 611 fmt.val = (unsigned long long int)fmt.val >> 2; \ 612 if ( fmt.wd > 21 ) fmt.wd -= 21; \ 613 if ( ! fmt.flags.nobsdp ) { if ( fmt.pc < fmt.wd ) fmt.wd -= 1; else fmt.pc -= 1; } \ 614 fmt2.wd = 1; \ 615 fmt2.val = ((msig & 0x3) << 1) + 1; \ 616 (ostype &)(os | fmt | "" | fmt2); \ 617 sepOff( os ); \ 618 fmt2.wd = 21; \ 619 fmt2.val = lsig & 0x7fffffffffffffff; \ 620 (ostype &)(os | fmt2); \ 621 } /* if */ \ 582 622 } else { \ 583 if ( f.flags.left ) { \ 584 if ( f.wd > 16 ) fmt2.wd = f.wd - 16; \ 585 fmt.wd = 16; \ 623 if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; \ 624 if ( fmt.flags.left ) { \ 625 fmt2.wd = fmt.wd; \ 626 if ( fmt2.wd <= 16 ) { \ 627 fmt2.wd = 16; \ 628 } else { \ 629 if ( fmt.pc > 0 ) { \ 630 fmt2.wd -= fmt.pc; \ 631 } else { \ 632 fmt2.wd = fmt.wd - ceiling2( high1( msig ), 4 ) / 4; \ 633 } /* if */ \ 634 if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \ 635 if ( fmt2.wd < 0 ) fmt2.wd = 0; \ 636 fmt2.flags.left = true; \ 637 fmt.wd = 0; \ 638 } /* if */ \ 586 639 } else { \ 587 if ( f.wd > 16 ) fmt.wd = f.wd - 16; \588 if ( f.flags.pc && f.pc > 16 ) fmt.pc = f.pc - 16; \589 640 fmt2.wd = 16; \ 641 if ( fmt.wd > 16 ) fmt.wd -= 16; \ 590 642 } /* if */ \ 643 fmt2.pc = 16; fmt2.flags.pc = true; \ 591 644 (ostype &)(os | fmt | "" | fmt2); \ 592 645 } /* if */ \
Note:
See TracChangeset
for help on using the changeset viewer.