[libc-commits] [libc] 2e8fa86 - [libc] Add explicit casts for gcc

Alex Brachet via libc-commits libc-commits at lists.llvm.org
Wed Jul 13 09:52:40 PDT 2022


Author: Alex Brachet
Date: 2022-07-13T16:52:13Z
New Revision: 2e8fa86e095b823013e71917e1b265a46dc16f91

URL: https://github.com/llvm/llvm-project/commit/2e8fa86e095b823013e71917e1b265a46dc16f91
DIFF: https://github.com/llvm/llvm-project/commit/2e8fa86e095b823013e71917e1b265a46dc16f91.diff

LOG: [libc] Add explicit casts for gcc

Added: 
    

Modified: 
    libc/src/__support/str_to_float.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h
index a690fce740945..2348603bd6e21 100644
--- a/libc/src/__support/str_to_float.h
+++ b/libc/src/__support/str_to_float.h
@@ -153,7 +153,7 @@ eisel_lemire(typename fputil::FPBits<T>::UIntType mantissa, int32_t exp10,
   BitsType final_mantissa = static_cast<BitsType>(high64(final_approx) >>
                             (msb + BITS_IN_MANTISSA -
                              (fputil::FloatProperties<T>::MANTISSA_WIDTH + 3)));
-  exp2 -= 1 ^ msb; // same as !msb
+  exp2 -= static_cast<uint32_t>(1 ^ msb); // same as !msb
 
   // Half-way ambiguity
   if (low64(final_approx) == 0 &&
@@ -259,7 +259,7 @@ inline bool eisel_lemire<long double>(
       final_approx_upper >>
       (msb + BITS_IN_MANTISSA -
        (fputil::FloatProperties<long double>::MANTISSA_WIDTH + 3));
-  exp2 -= 1 ^ msb; // same as !msb
+  exp2 -= static_cast<uint32_t>(1 ^ msb); // same as !msb
 
   // Half-way ambiguity
   if (final_approx_lower == 0 && (final_approx_upper & HALFWAY_CONSTANT) == 0 &&


        


More information about the libc-commits mailing list