[libc-commits] [PATCH] D149594: [libc] Add explicit constructor calls to fix compilation when using UInt<T>

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat May 20 22:03:21 PDT 2023


sivachandra added inline comments.


================
Comment at: libc/src/__support/FPUtil/x86_64/LongDoubleBits.h:129
+    return cpp::bit_cast<long double>(bits_with_explicit_bit);
+  }
+
----------------
Why was this method added? In other words, why was not required previously?


================
Comment at: libc/src/__support/str_to_float.h:306
+  exp2 -=
+      static_cast<uint32_t>(1ULL ^ static_cast<uint64_t>(msb)); // same as !msb
 
----------------
Why not this directly:

```
exp2 -= static_cast<uint32_t>(1) ^ static_cast<uint32_t>(msb);
```


================
Comment at: libc/src/stdio/printf_core/float_dec_converter.h:1154
+    fputil::FPBits<double>::UIntType float_raw =
+        static_cast<uint64_t>(to_conv.conv_val_raw);
     fputil::FPBits<double> float_bits(float_raw);
----------------
`FPBits<double>::UIntType`


================
Comment at: libc/src/stdio/printf_core/float_dec_converter.h:1175
+    fputil::FPBits<double>::UIntType float_raw =
+        static_cast<uint64_t>(to_conv.conv_val_raw);
     fputil::FPBits<double> float_bits(float_raw);
----------------
Ditto


================
Comment at: libc/src/stdio/printf_core/float_dec_converter.h:1196
+    fputil::FPBits<double>::UIntType float_raw =
+        static_cast<uint64_t>(to_conv.conv_val_raw);
     fputil::FPBits<double> float_bits(float_raw);
----------------
Ditto


================
Comment at: libc/src/stdio/printf_core/float_hex_converter.h:55
+    fputil::FPBits<double>::UIntType float_raw =
+        static_cast<uint64_t>(to_conv.conv_val_raw);
     fputil::FPBits<double> float_bits(float_raw);
----------------
Ditto


================
Comment at: libc/src/stdio/printf_core/float_inf_nan_converter.h:40
+    fputil::FPBits<double>::UIntType float_raw =
+        static_cast<uint64_t>(to_conv.conv_val_raw);
     fputil::FPBits<double> float_bits(float_raw);
----------------
Ditto


================
Comment at: libc/src/stdio/printf_core/int_converter.h:46
 
-  uintmax_t num = to_conv.conv_val_raw;
+  uintmax_t num = static_cast<uint64_t>(to_conv.conv_val_raw);
   bool is_negative = false;
----------------
Why not `uintmax_t` directly?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149594/new/

https://reviews.llvm.org/D149594



More information about the libc-commits mailing list