diff --git a/libc/test/src/math/smoke/GetPayloadTest.h b/libc/test/src/math/smoke/GetPayloadTest.h index 6e30de76431199..922a2f04f6fb3c 100644 --- a/libc/test/src/math/smoke/GetPayloadTest.h +++ b/libc/test/src/math/smoke/GetPayloadTest.h @@ -38,7 +38,14 @@ class GetPayloadTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest { EXPECT_FP_EQ(T(0.0), funcWrapper(func, aNaN)); EXPECT_FP_EQ(T(0.0), funcWrapper(func, neg_aNaN)); - T default_snan_payload = StorageType(1) << (FPBits::SIG_LEN - 2); + // Essentially this: + // T default_snan_payload = StorageType(1) << (FPBits::SIG_LEN - 2); + // but supports StorageType being a BigInt. + FPBits default_snan_payload_bits = FPBits::one(); + default_snan_payload_bits.set_biased_exponent(FPBits::SIG_LEN - 2 + + FPBits::EXP_BIAS); + T default_snan_payload = default_snan_payload_bits.get_val(); + EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, sNaN)); EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, neg_sNaN));