Changeset ac9ba12 for libcfa/src


Ignore:
Timestamp:
Jul 6, 2020, 4:47:01 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6437ce4
Parents:
82bbaf4
Message:

add comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r82bbaf4 rac9ba12  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul  5 08:14:07 2020
    13 // Update Count     : 1063
     12// Last Modified On : Mon Jul  6 08:49:48 2020
     13// Update Count     : 1064
    1414//
    1515
     
    674674                base_128( os, val / power, power, f, maxdig, bits, cnt + 1 ); // recursive
    675675                f.val = val % power;
    676                 if ( cnt == 1 && f.flags.left ) { wd = f.wd; f.wd = maxdig; } // copy f.wd across printing of middle value
     676                if ( cnt == 1 && f.flags.left ) { wd = f.wd; f.wd = maxdig; } // copy f.wd and reset for printing middle chunk
    677677                (ostype &)(os | f);
    678678                if ( cnt == 1 ) {
    679                         if ( f.flags.left ) { wd -= maxdig; f.wd = wd < 0 ? 1 : wd; }
     679                        if ( f.flags.left ) { wd -= maxdig; f.wd = wd < 0 ? 1 : wd; } // update and restore f.wd for printing end chunk
    680680                        sepOff( os );                                                           // no seperator between chunks
    681681                } // if
    682         } else {
     682        } else {                                                                                        // print start chunk
    683683                f.val = val;
    684684                // f.pc is unsigned => use wd
     
    693693                        if ( cnt != 0 ) {                                                       // value >= 2^64 ?
    694694                                unsigned int dig, bs = 0;
    695                                 // compute size of prefix base and digits
     695                                // compute size of prefix digits and base
    696696                                if ( f.base == 'd' || f.base == 'u' ) { // no base prefix
    697697                                        dig = ceil( log10( f.val ) );           // use floating-point
     
    717717                (ostype &)(os | f);
    718718
     719                // remaining middle and end chunks are padded with 0s on the left
    719720                if ( ! f.flags.left ) { f.flags.pad0 = true; f.flags.pc = false; } // left pad with 0s
    720721                else { f.pc = maxdig; f.flags.pc = true; }              // left pad with precision
     722
    721723                if ( cnt != 0 ) sepOff( os );                                   // no seperator between chunks
    722                 f.wd = wd;
    723                 f.flags.sign = false;                                                   // no +/- sign
    724                 f.flags.nobsdp = true;                                                  // no base prefix
     724                f.wd = wd;                                                                              // reset f.wd for next chunk
     725                f.flags.sign = false;                                                   // no leading +/- sign
     726                f.flags.nobsdp = true;                                                  // no leading base prefix
    725727        } // if
    726728} // base_128
Note: See TracChangeset for help on using the changeset viewer.