[libc-commits] [libc] [libc][NFC] rename LONG_DOUBLE_IS_DOUBLE into LIBC_LONG_DOUBLE_IS_DOUBLE (PR #73948)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Fri Dec 1 00:52:51 PST 2023
https://github.com/gchatelet updated https://github.com/llvm/llvm-project/pull/73948
>From c624c1b47988ab37192e3ec4f89f1a8fe6b12900 Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Thu, 30 Nov 2023 14:59:40 +0000
Subject: [PATCH 1/3] [libc][NFC] rename LONG_DOUBLE_IS_DOUBLE into
LIBC_LONG_DOUBLE_IS_DOUBLE
---
libc/src/__support/FPUtil/generic/sqrt.h | 2 +-
libc/src/__support/FPUtil/x86_64/sqrt.h | 2 +-
libc/src/__support/float_to_string.h | 4 +-
libc/src/__support/macros/properties/float.h | 3 +-
libc/src/__support/str_to_float.h | 4 +-
.../test/src/__support/FPUtil/fpbits_test.cpp | 2 +-
libc/test/src/__support/str_to_float_test.cpp | 2 +-
libc/test/src/stdio/sprintf_test.cpp | 44 +++++++++----------
libc/test/src/stdio/sscanf_test.cpp | 2 +-
libc/test/src/stdlib/strtold_test.cpp | 4 +-
10 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/libc/src/__support/FPUtil/generic/sqrt.h b/libc/src/__support/FPUtil/generic/sqrt.h
index 63e8329b066074a..08ae6e4cd4d9b92 100644
--- a/libc/src/__support/FPUtil/generic/sqrt.h
+++ b/libc/src/__support/FPUtil/generic/sqrt.h
@@ -43,7 +43,7 @@ LIBC_INLINE void normalize(int &exponent,
mantissa <<= shift;
}
-#ifdef LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
template <>
LIBC_INLINE void normalize<long double>(int &exponent, uint64_t &mantissa) {
normalize<double>(exponent, mantissa);
diff --git a/libc/src/__support/FPUtil/x86_64/sqrt.h b/libc/src/__support/FPUtil/x86_64/sqrt.h
index 7edba5528d6a91e..31cb73c38fbe416 100644
--- a/libc/src/__support/FPUtil/x86_64/sqrt.h
+++ b/libc/src/__support/FPUtil/x86_64/sqrt.h
@@ -33,7 +33,7 @@ template <> LIBC_INLINE double sqrt<double>(double x) {
return result;
}
-#ifdef LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
template <> LIBC_INLINE long double sqrt<long double>(long double x) {
long double result;
__asm__ __volatile__("sqrtsd %x1, %x0" : "=x"(result) : "x"(x));
diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h
index eb06cd9c08af287..fee7474aed293b2 100644
--- a/libc/src/__support/float_to_string.h
+++ b/libc/src/__support/float_to_string.h
@@ -602,7 +602,7 @@ class FloatToString {
}
};
-#ifndef LONG_DOUBLE_IS_DOUBLE
+#ifndef LIBC_LONG_DOUBLE_IS_DOUBLE
// --------------------------- LONG DOUBLE FUNCTIONS ---------------------------
template <>
@@ -754,7 +754,7 @@ FloatToString<long double>::get_negative_block(int block_index) {
}
}
-#endif // LONG_DOUBLE_IS_DOUBLE
+#endif // LIBC_LONG_DOUBLE_IS_DOUBLE
} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/macros/properties/float.h b/libc/src/__support/macros/properties/float.h
index 7e00ddc8f0cd327..1d025575934a870 100644
--- a/libc/src/__support/macros/properties/float.h
+++ b/libc/src/__support/macros/properties/float.h
@@ -19,8 +19,7 @@
// 'long double' properties.
#if (LDBL_MANT_DIG == DBL_MANT_DIG)
-// TODO: Replace with LIBC_LONG_DOUBLE_IS_DOUBLE
-#define LONG_DOUBLE_IS_DOUBLE
+#define LIBC_LONG_DOUBLE_IS_DOUBLE
#endif
#if (LDBL_MANT_DIG == 64)
// TODO: Replace with LIBC_LONG_DOUBLE_IS_X86_BIN80
diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h
index 81ab36dbf9471fb..02f9903b83e2fe6 100644
--- a/libc/src/__support/str_to_float.h
+++ b/libc/src/__support/str_to_float.h
@@ -221,7 +221,7 @@ eisel_lemire(ExpandedFloat<T> init_num,
return output;
}
-#if !defined(LONG_DOUBLE_IS_DOUBLE)
+#if !defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
template <>
LIBC_INLINE cpp::optional<ExpandedFloat<long double>>
eisel_lemire<long double>(ExpandedFloat<long double> init_num,
@@ -516,7 +516,7 @@ template <> class ClingerConsts<double> {
static constexpr double MAX_EXACT_INT = 9007199254740991.0;
};
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
template <> class ClingerConsts<long double> {
public:
static constexpr long double POWERS_OF_TEN_ARRAY[] = {
diff --git a/libc/test/src/__support/FPUtil/fpbits_test.cpp b/libc/test/src/__support/FPUtil/fpbits_test.cpp
index 027db8807ab226a..f0fb7436e7c7015 100644
--- a/libc/test/src/__support/FPUtil/fpbits_test.cpp
+++ b/libc/test/src/__support/FPUtil/fpbits_test.cpp
@@ -213,7 +213,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
}
#else
TEST(LlvmLibcFPBitsTest, LongDoubleType) {
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
return; // The tests for the "double" type cover for this case.
#else
using LongDoubleBits = FPBits<long double>;
diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp
index ae729418ebe3639..b5d0b29c253d5d1 100644
--- a/libc/test/src/__support/str_to_float_test.cpp
+++ b/libc/test/src/__support/str_to_float_test.cpp
@@ -279,7 +279,7 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) {
EXPECT_EQ(double_result.error, 0);
}
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat64AsLongDouble) {
eisel_lemire_test<long double>(123, 0, 0x1EC00000000000, 1029);
}
diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp
index e41579a20656b72..17ad19afbfb1ec1 100644
--- a/libc/test/src/stdio/sprintf_test.cpp
+++ b/libc/test/src/stdio/sprintf_test.cpp
@@ -644,7 +644,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -653,7 +653,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -662,7 +662,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -768,7 +768,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -777,7 +777,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -1024,14 +1024,14 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
// Some float128 systems (specifically the ones used for aarch64 buildbots)
// don't respect signs for long double NaNs.
-#if defined(SPECIAL_X86_LONG_DOUBLE) || defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(SPECIAL_X86_LONG_DOUBLE) || defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
written = LIBC_NAMESPACE::sprintf(buff, "%LF", -ld_nan);
ASSERT_STREQ_LEN(written, buff, "-NAN");
#endif
// Length Modifier Tests.
- // TODO(michaelrj): Add tests for LONG_DOUBLE_IS_DOUBLE and 128 bit long
+ // TODO(michaelrj): Add tests for LIBC_LONG_DOUBLE_IS_DOUBLE and 128 bit long
// double systems.
// TODO(michaelrj): Fix the tests to only depend on the digits the long double
// is accurate for.
@@ -1333,7 +1333,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -1342,7 +1342,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -1351,7 +1351,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -1550,7 +1550,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -1559,7 +1559,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -1977,7 +1977,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -1986,7 +1986,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -1995,7 +1995,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -2173,7 +2173,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -2182,7 +2182,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -2616,7 +2616,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -2625,7 +2625,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -2634,7 +2634,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -2822,7 +2822,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -2831,7 +2831,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
- #elif defined(LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
diff --git a/libc/test/src/stdio/sscanf_test.cpp b/libc/test/src/stdio/sscanf_test.cpp
index ec53c08bd9d41bf..064a1a511881d8b 100644
--- a/libc/test/src/stdio/sscanf_test.cpp
+++ b/libc/test/src/stdio/sscanf_test.cpp
@@ -322,7 +322,7 @@ TEST(LlvmLibcSScanfTest, FloatConvLengthModifier) {
EXPECT_EQ(ret_val, 1);
// 1e600 may be larger than the maximum long double (if long double is double).
// In that case both of these should be evaluated as inf.
-#ifdef LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
EXPECT_FP_EQ(ld_result, d_inf);
#else
EXPECT_FP_EQ(ld_result, 1.0e600L);
diff --git a/libc/test/src/stdlib/strtold_test.cpp b/libc/test/src/stdlib/strtold_test.cpp
index 680a93188c76d1d..42834398573f429 100644
--- a/libc/test/src/stdlib/strtold_test.cpp
+++ b/libc/test/src/stdlib/strtold_test.cpp
@@ -16,7 +16,7 @@
#include <limits.h>
#include <stddef.h>
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
#define SELECT_CONST(val, _, __) val
#elif defined(SPECIAL_X86_LONG_DOUBLE)
#define SELECT_CONST(_, val, __) val
@@ -26,7 +26,7 @@
class LlvmLibcStrToLDTest : public LIBC_NAMESPACE::testing::Test {
public:
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
void run_test(const char *inputString, const ptrdiff_t expectedStrLen,
const uint64_t expectedRawData, const int expectedErrno = 0)
#else
>From 86a64add3fe10f2e58fcc46b453d173c287cf58f Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Fri, 1 Dec 2023 08:49:02 +0000
Subject: [PATCH 2/3] use LIBC_LONG_DOUBLE_IS_FLOAT64 instead
---
libc/src/__support/FPUtil/generic/sqrt.h | 2 +-
libc/src/__support/FPUtil/x86_64/sqrt.h | 2 +-
libc/src/__support/float_to_string.h | 4 +-
libc/src/__support/macros/properties/float.h | 2 +-
libc/src/__support/str_to_float.h | 4 +-
.../test/src/__support/FPUtil/fpbits_test.cpp | 2 +-
libc/test/src/__support/str_to_float_test.cpp | 2 +-
libc/test/src/stdio/sprintf_test.cpp | 44 +++++++++----------
libc/test/src/stdio/sscanf_test.cpp | 2 +-
libc/test/src/stdlib/strtold_test.cpp | 4 +-
10 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/libc/src/__support/FPUtil/generic/sqrt.h b/libc/src/__support/FPUtil/generic/sqrt.h
index 08ae6e4cd4d9b92..9c7e6a2f361c674 100644
--- a/libc/src/__support/FPUtil/generic/sqrt.h
+++ b/libc/src/__support/FPUtil/generic/sqrt.h
@@ -43,7 +43,7 @@ LIBC_INLINE void normalize(int &exponent,
mantissa <<= shift;
}
-#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_FLOAT64
template <>
LIBC_INLINE void normalize<long double>(int &exponent, uint64_t &mantissa) {
normalize<double>(exponent, mantissa);
diff --git a/libc/src/__support/FPUtil/x86_64/sqrt.h b/libc/src/__support/FPUtil/x86_64/sqrt.h
index 31cb73c38fbe416..cf3eb9b2f494cdd 100644
--- a/libc/src/__support/FPUtil/x86_64/sqrt.h
+++ b/libc/src/__support/FPUtil/x86_64/sqrt.h
@@ -33,7 +33,7 @@ template <> LIBC_INLINE double sqrt<double>(double x) {
return result;
}
-#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_FLOAT64
template <> LIBC_INLINE long double sqrt<long double>(long double x) {
long double result;
__asm__ __volatile__("sqrtsd %x1, %x0" : "=x"(result) : "x"(x));
diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h
index fee7474aed293b2..1bb4e5c5b9246a5 100644
--- a/libc/src/__support/float_to_string.h
+++ b/libc/src/__support/float_to_string.h
@@ -602,7 +602,7 @@ class FloatToString {
}
};
-#ifndef LIBC_LONG_DOUBLE_IS_DOUBLE
+#ifndef LIBC_LONG_DOUBLE_IS_FLOAT64
// --------------------------- LONG DOUBLE FUNCTIONS ---------------------------
template <>
@@ -754,7 +754,7 @@ FloatToString<long double>::get_negative_block(int block_index) {
}
}
-#endif // LIBC_LONG_DOUBLE_IS_DOUBLE
+#endif // LIBC_LONG_DOUBLE_IS_FLOAT64
} // namespace LIBC_NAMESPACE
diff --git a/libc/src/__support/macros/properties/float.h b/libc/src/__support/macros/properties/float.h
index 1d025575934a870..f06252ff2770f96 100644
--- a/libc/src/__support/macros/properties/float.h
+++ b/libc/src/__support/macros/properties/float.h
@@ -19,7 +19,7 @@
// 'long double' properties.
#if (LDBL_MANT_DIG == DBL_MANT_DIG)
-#define LIBC_LONG_DOUBLE_IS_DOUBLE
+#define LIBC_LONG_DOUBLE_IS_FLOAT64
#endif
#if (LDBL_MANT_DIG == 64)
// TODO: Replace with LIBC_LONG_DOUBLE_IS_X86_BIN80
diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h
index 02f9903b83e2fe6..a92325730414262 100644
--- a/libc/src/__support/str_to_float.h
+++ b/libc/src/__support/str_to_float.h
@@ -221,7 +221,7 @@ eisel_lemire(ExpandedFloat<T> init_num,
return output;
}
-#if !defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#if !defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
template <>
LIBC_INLINE cpp::optional<ExpandedFloat<long double>>
eisel_lemire<long double>(ExpandedFloat<long double> init_num,
@@ -516,7 +516,7 @@ template <> class ClingerConsts<double> {
static constexpr double MAX_EXACT_INT = 9007199254740991.0;
};
-#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
template <> class ClingerConsts<long double> {
public:
static constexpr long double POWERS_OF_TEN_ARRAY[] = {
diff --git a/libc/test/src/__support/FPUtil/fpbits_test.cpp b/libc/test/src/__support/FPUtil/fpbits_test.cpp
index f0fb7436e7c7015..52635cc2af09401 100644
--- a/libc/test/src/__support/FPUtil/fpbits_test.cpp
+++ b/libc/test/src/__support/FPUtil/fpbits_test.cpp
@@ -213,7 +213,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
}
#else
TEST(LlvmLibcFPBitsTest, LongDoubleType) {
-#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
return; // The tests for the "double" type cover for this case.
#else
using LongDoubleBits = FPBits<long double>;
diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp
index b5d0b29c253d5d1..c2643d9a764ee63 100644
--- a/libc/test/src/__support/str_to_float_test.cpp
+++ b/libc/test/src/__support/str_to_float_test.cpp
@@ -279,7 +279,7 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) {
EXPECT_EQ(double_result.error, 0);
}
-#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat64AsLongDouble) {
eisel_lemire_test<long double>(123, 0, 0x1EC00000000000, 1029);
}
diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp
index 17ad19afbfb1ec1..e2265f5efbc465c 100644
--- a/libc/test/src/stdio/sprintf_test.cpp
+++ b/libc/test/src/stdio/sprintf_test.cpp
@@ -644,7 +644,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
-#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -653,7 +653,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
-#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -662,7 +662,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
-#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -768,7 +768,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
-#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -777,7 +777,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
-#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -1024,14 +1024,14 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
// Some float128 systems (specifically the ones used for aarch64 buildbots)
// don't respect signs for long double NaNs.
-#if defined(SPECIAL_X86_LONG_DOUBLE) || defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#if defined(SPECIAL_X86_LONG_DOUBLE) || defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
written = LIBC_NAMESPACE::sprintf(buff, "%LF", -ld_nan);
ASSERT_STREQ_LEN(written, buff, "-NAN");
#endif
// Length Modifier Tests.
- // TODO(michaelrj): Add tests for LIBC_LONG_DOUBLE_IS_DOUBLE and 128 bit long
+ // TODO(michaelrj): Add tests for LIBC_LONG_DOUBLE_IS_FLOAT64 and 128 bit long
// double systems.
// TODO(michaelrj): Fix the tests to only depend on the digits the long double
// is accurate for.
@@ -1333,7 +1333,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -1342,7 +1342,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -1351,7 +1351,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -1550,7 +1550,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -1559,7 +1559,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -1977,7 +1977,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -1986,7 +1986,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -1995,7 +1995,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -2173,7 +2173,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -2182,7 +2182,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -2616,7 +2616,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -2625,7 +2625,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -2634,7 +2634,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x0p+0");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -2822,7 +2822,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
#if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -2831,7 +2831,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
- #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+ #elif defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
ASSERT_STREQ_LEN(written, buff, "inf");
#else // 128 bit long double
ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
diff --git a/libc/test/src/stdio/sscanf_test.cpp b/libc/test/src/stdio/sscanf_test.cpp
index 064a1a511881d8b..db3c48cdbf7a2d5 100644
--- a/libc/test/src/stdio/sscanf_test.cpp
+++ b/libc/test/src/stdio/sscanf_test.cpp
@@ -322,7 +322,7 @@ TEST(LlvmLibcSScanfTest, FloatConvLengthModifier) {
EXPECT_EQ(ret_val, 1);
// 1e600 may be larger than the maximum long double (if long double is double).
// In that case both of these should be evaluated as inf.
-#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_FLOAT64
EXPECT_FP_EQ(ld_result, d_inf);
#else
EXPECT_FP_EQ(ld_result, 1.0e600L);
diff --git a/libc/test/src/stdlib/strtold_test.cpp b/libc/test/src/stdlib/strtold_test.cpp
index 42834398573f429..1ddf729689ff6c1 100644
--- a/libc/test/src/stdlib/strtold_test.cpp
+++ b/libc/test/src/stdlib/strtold_test.cpp
@@ -16,7 +16,7 @@
#include <limits.h>
#include <stddef.h>
-#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
#define SELECT_CONST(val, _, __) val
#elif defined(SPECIAL_X86_LONG_DOUBLE)
#define SELECT_CONST(_, val, __) val
@@ -26,7 +26,7 @@
class LlvmLibcStrToLDTest : public LIBC_NAMESPACE::testing::Test {
public:
-#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_FLOAT64)
void run_test(const char *inputString, const ptrdiff_t expectedStrLen,
const uint64_t expectedRawData, const int expectedErrno = 0)
#else
>From 78c7ed27cf4013fb98990866899fefac7b71a211 Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Fri, 1 Dec 2023 08:52:30 +0000
Subject: [PATCH 3/3] Change detection
---
libc/src/__support/macros/properties/float.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libc/src/__support/macros/properties/float.h b/libc/src/__support/macros/properties/float.h
index f06252ff2770f96..d217c347d52447e 100644
--- a/libc/src/__support/macros/properties/float.h
+++ b/libc/src/__support/macros/properties/float.h
@@ -18,10 +18,9 @@
#include <float.h> // LDBL_MANT_DIG
// 'long double' properties.
-#if (LDBL_MANT_DIG == DBL_MANT_DIG)
+#if (LDBL_MANT_DIG == 53)
#define LIBC_LONG_DOUBLE_IS_FLOAT64
-#endif
-#if (LDBL_MANT_DIG == 64)
+#elif (LDBL_MANT_DIG == 64)
// TODO: Replace with LIBC_LONG_DOUBLE_IS_X86_BIN80
#define SPECIAL_X86_LONG_DOUBLE
#elif (LDBL_MANT_DIG == 113)
More information about the libc-commits
mailing list