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

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jun 6 13:12:10 PDT 2023


michaelrj added inline comments.


================
Comment at: libc/src/__support/FPUtil/x86_64/LongDoubleBits.h:129
+    bits_with_explicit_bit &= ~(UIntType(1) << FloatProp::MANTISSA_WIDTH);
+    bits_with_explicit_bit |= (UIntType(true) << FloatProp::MANTISSA_WIDTH);
+    return cpp::bit_cast<long double>(bits_with_explicit_bit);
----------------
michaelrj wrote:
> I'm not sure this is correct, this seems to be setting the explicit bit in the output regardless of if it is set in the actual number. An example of where this might go wrong is the number `0.0`.
I meant more that if `bits` is accurate, then you shouldn't need to add the explicit bit separately at all. In `get_explicit_mantissa` it expands the mask to cover the explicit leading bit, but doesn't actually modify the resulting number at all.


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