[libc-commits] [libc] [libc][math][c23] Fix totalorderf128 requiring support for 128-bit ints (PR #101229)

via libc-commits libc-commits at lists.llvm.org
Tue Jul 30 12:27:29 PDT 2024


https://github.com/overmighty created https://github.com/llvm/llvm-project/pull/101229

None

>From a9a10d2f32b163f648a3c908c8aee2fdb7dd5c4a Mon Sep 17 00:00:00 2001
From: OverMighty <its.overmighty at gmail.com>
Date: Tue, 30 Jul 2024 21:18:04 +0200
Subject: [PATCH] [libc][math][c23] Fix totalorderf128 requiring support for
 128-bit ints

---
 libc/src/__support/FPUtil/BasicOperations.h | 3 ++-
 libc/src/__support/FPUtil/CMakeLists.txt    | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 50f1e19e08d64..d68f3ae6a26bb 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -14,6 +14,7 @@
 #include "dyadic_float.h"
 
 #include "src/__support/CPP/type_traits.h"
+#include "src/__support/big_int.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
@@ -320,7 +321,7 @@ totalorder(T x, T y) {
   StorageType x_u = x_bits.uintval();
   StorageType y_u = y_bits.uintval();
 
-  using signed_t = cpp::make_signed_t<StorageType>;
+  using signed_t = make_integral_or_big_int_signed_t<StorageType>;
   signed_t x_signed = static_cast<signed_t>(x_u);
   signed_t y_signed = static_cast<signed_t>(y_u);
 
diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt
index bfdfffb85c255..ea1e0e8b39d10 100644
--- a/libc/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/CMakeLists.txt
@@ -189,6 +189,7 @@ add_header_library(
     .fp_bits
     .fenv_impl
     libc.src.__support.CPP.type_traits
+    libc.src.__support.big_int
     libc.src.__support.uint128
     libc.src.__support.common
     libc.src.__support.macros.optimization



More information about the libc-commits mailing list