[libc-commits] [libc] [libc] Make `BigInt` bitwise shift consistent with regular integral semantics. (PR #87762)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Fri Apr 5 09:22:26 PDT 2024
================
@@ -122,15 +122,17 @@ template <size_t Bits> struct DyadicFloat {
int exp_lo = exp_hi - static_cast<int>(PRECISION) - 1;
- MantissaType m_hi(mantissa >> shift);
+ MantissaType m_hi =
+ shift >= MantissaType::BITS ? MantissaType(0) : mantissa >> shift;
----------------
gchatelet wrote:
Without these changes the tests are failing, so apparently `shift` may be greater or equal to `BITS`. I also ran the tests with `-fsanitize=undefined` using `__uint128_t` as the `MantissaType` in a separate patch and it reported an out of bound shift at these locations.
https://github.com/llvm/llvm-project/pull/87762
More information about the libc-commits
mailing list