Changeset ffa48a8 for libcfa/src


Ignore:
Timestamp:
Jul 20, 2020, 3:52:30 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:
7d94bfe3
Parents:
896f083
Message:

patch bug causing print of -0 for gcc 5 & 6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r896f083 rffa48a8  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 16 07:43:31 2020
    13 // Update Count     : 1102
     12// Last Modified On : Mon Jul 20 15:00:37 2020
     13// Update Count     : 1124
    1414//
    1515
     
    167167        #define P10_UINT64 10_000_000_000_000_000_000_ULL       // 19 zeroes
    168168
    169         static void base10_128( ostype & os, unsigned int128 val ) {
     169        static inline void base10_128( ostype & os, unsigned int128 val ) {
     170#if defined(__GNUC__) && __GNUC_PREREQ(7,0)                             // gcc version >= 7
    170171                if ( val > P10_UINT64 ) {
     172#else
     173                if ( (uint64_t)(val >> 64) != 0 || (uint64_t)val > P10_UINT64 ) { // patch gcc 5 & 6 -O3 bug
     174#endif // __GNUC_PREREQ(7,0)
    171175                        base10_128( os, val / P10_UINT64 );                     // recursive
    172176                        fmt( os, "%.19lu", (uint64_t)(val % P10_UINT64) );
     
    176180        } // base10_128
    177181
    178         static void base10_128( ostype & os, int128 val ) {
     182        static inline void base10_128( ostype & os, int128 val ) {
    179183                if ( val < 0 ) {
    180184                        fmt( os, "-" );                                                         // leading negative sign
Note: See TracChangeset for help on using the changeset viewer.