[libc-commits] [libc] [libc] Fixing float128 UB error (PR #211593)

via libc-commits libc-commits at lists.llvm.org
Thu Jul 30 09:24:06 PDT 2026


================
@@ -472,7 +472,12 @@ template <size_t Bits> struct DyadicFloat {
       // exponents coming in to this function _shouldn't_ be that large). The
       // result should always end up as a positive size_t.
       size_t shift = -static_cast<size_t>(exponent);
-      new_mant >>= shift;
+      size_t limit =
+          static_cast<size_t>(cpp::numeric_limits<MantissaType>::digits);
----------------
overmighty wrote:

`static_cast` shouldn't be necessary here.


```suggestion
      size_t limit = cpp::numeric_limits<MantissaType>::digits;
```

https://github.com/llvm/llvm-project/pull/211593


More information about the libc-commits mailing list