[libc-commits] [libc] [libc][math] Qualify getpayload functions to constexpr (PR #195532)

Muhammad Bassiouni via libc-commits libc-commits at lists.llvm.org
Sun May 3 20:31:41 PDT 2026


================
@@ -35,6 +35,12 @@ static_assert(0.0 == LIBC_NAMESPACE::shared::ufromfp(0.0, 0, 32));
 static_assert(0.0 == LIBC_NAMESPACE::shared::ufromfpx(0.0, 0, 32));
 static_assert(0.0 == LIBC_NAMESPACE::shared::fmaximum_mag(0.0, 0.0));
 static_assert(0.0 == LIBC_NAMESPACE::shared::fminimum_mag(0.0, 0.0));
+static_assert(42.0 == [] {
+  double nan = LIBC_NAMESPACE::fputil::FPBits<double>::quiet_nan(
+                   LIBC_NAMESPACE::Sign::POS, 42)
+                   .get_val();
+  return LIBC_NAMESPACE::shared::getpayload(&nan);
+}());
----------------
bassiounix wrote:

I suggest to follow the same test found in the other test file with the same numbers

```suggestion
static_assert(-1.0 == [] {
  double getpayload_x = 0.0;
  return LIBC_NAMESPACE::shared::getpayload(&getpayload_x);
}());
```

change all the tests accrodingly

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


More information about the libc-commits mailing list