[libc-commits] [libc] [libc][complex] fix guard for cfloat128 and float128 (PR #119330)

Shourya Goel via libc-commits libc-commits at lists.llvm.org
Mon Dec 9 22:08:34 PST 2024


https://github.com/Sh0g0-1758 created https://github.com/llvm/llvm-project/pull/119330

None

>From 59f6fe53272c1bcb1be702781dea9f593383bd8a Mon Sep 17 00:00:00 2001
From: Sh0g0-1758 <shouryagoel10000 at gmail.com>
Date: Tue, 10 Dec 2024 11:36:46 +0530
Subject: [PATCH 1/2] nit

---
 libc/src/__support/complex_type.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libc/src/__support/complex_type.h b/libc/src/__support/complex_type.h
index 88239886f983b5..11092521f8fcc5 100644
--- a/libc/src/__support/complex_type.h
+++ b/libc/src/__support/complex_type.h
@@ -36,13 +36,11 @@ template <> struct make_complex<float16> {
   using type = cfloat16;
 };
 #endif
-#if defined(LIBC_TYPES_HAS_CFLOAT128)
-#if !(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
+#if defined(LIBC_TYPES_HAS_CFLOAT128) && !defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
 template <> struct make_complex<float128> {
   using type = cfloat128;
 };
 #endif
-#endif
 
 template <typename T> using make_complex_t = typename make_complex<T>::type;
 
@@ -63,13 +61,11 @@ template <> struct make_real<cfloat16> {
   using type = float16;
 };
 #endif
-#if defined(LIBC_TYPES_HAS_CFLOAT128)
-#if !(LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE)
+#if defined(LIBC_TYPES_HAS_CFLOAT128) && !defined(LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE)
 template <> struct make_real<cfloat128> {
   using type = float128;
 };
 #endif
-#endif
 
 template <typename T> using make_real_t = typename make_real<T>::type;
 

>From 605424997aa5d5086b260cb644a3350b274d66a5 Mon Sep 17 00:00:00 2001
From: Sh0g0-1758 <shouryagoel10000 at gmail.com>
Date: Tue, 10 Dec 2024 11:37:04 +0530
Subject: [PATCH 2/2] fmt

---
 libc/src/__support/complex_type.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libc/src/__support/complex_type.h b/libc/src/__support/complex_type.h
index 11092521f8fcc5..a6207d38d0eb57 100644
--- a/libc/src/__support/complex_type.h
+++ b/libc/src/__support/complex_type.h
@@ -36,7 +36,8 @@ template <> struct make_complex<float16> {
   using type = cfloat16;
 };
 #endif
-#if defined(LIBC_TYPES_HAS_CFLOAT128) && !defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
+#if defined(LIBC_TYPES_HAS_CFLOAT128) &&                                       \
+    !defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
 template <> struct make_complex<float128> {
   using type = cfloat128;
 };
@@ -61,7 +62,8 @@ template <> struct make_real<cfloat16> {
   using type = float16;
 };
 #endif
-#if defined(LIBC_TYPES_HAS_CFLOAT128) && !defined(LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE)
+#if defined(LIBC_TYPES_HAS_CFLOAT128) &&                                       \
+    !defined(LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE)
 template <> struct make_real<cfloat128> {
   using type = float128;
 };



More information about the libc-commits mailing list