Changeset 7fd71c7
- Timestamp:
- Apr 21, 2020, 8:25:36 PM (4 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:
- 88293c7
- Parents:
- fd35f76
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
rfd35f76 r7fd71c7 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 : Mon Apr 20 21:55:00 2020 13 // Update Count : 912 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 fmt2.wd = fmt.wd; \ 598 if ( fmt2.wd <= 21 ) { \ 599 fmt2.wd = fmt2.pc = 16; fmt2.flags.pc = true; \ 600 } else { \ 601 } /* if */ \ 602 } else { \ 603 fmt.val = (unsigned long long int)fmt.val >> 2; \ 604 if ( fmt.wd > 21 ) fmt.wd -= 21; \ 605 if ( ! fmt.flags.nobsdp ) { if ( fmt.pc < fmt.wd ) fmt.wd -= 1; else fmt.pc -= 1; } \ 606 fmt2.wd = 1; \ 607 fmt2.val = ((msig & 0x3) << 1) + 1; \ 608 (ostype &)(os | fmt | "" | fmt2); \ 609 sepOff( os ); \ 610 fmt2.wd = 21; \ 611 fmt2.val = lsig & 0x7fffffffffffffff; \ 612 (ostype &)(os | fmt2); \ 613 } /* if */ \ 582 614 } else { \ 583 if ( f.flags.left ) { \ 584 if ( f.wd > 16 ) fmt2.wd = f.wd - 16; \ 585 fmt.wd = 16; \ 615 if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; \ 616 if ( fmt.flags.left ) { \ 617 fmt2.wd = fmt.wd; \ 618 if ( fmt2.wd <= 16 ) { \ 619 fmt2.wd = 16; \ 620 } else { \ 621 if ( fmt.pc > 0 ) { \ 622 fmt2.wd -= fmt.pc; \ 623 } else { \ 624 fmt2.wd = fmt.wd - ceiling2( high1( msig ), 4 ) / 4; \ 625 } /* if */ \ 626 if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \ 627 if ( fmt2.wd < 0 ) fmt2.wd = 0; \ 628 fmt2.flags.left = true; \ 629 fmt.wd = 0; \ 630 } /* if */ \ 586 631 } 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 632 fmt2.wd = 16; \ 633 if ( fmt.wd > 16 ) fmt.wd -= 16; \ 590 634 } /* if */ \ 635 fmt2.pc = 16; fmt2.flags.pc = true; \ 591 636 (ostype &)(os | fmt | "" | fmt2); \ 592 637 } /* if */ \
Note: See TracChangeset
for help on using the changeset viewer.