[libc-commits] [libc] [libc][math] Fix issignaling macro usage in the implementation. (PR #112235)
via libc-commits
libc-commits at lists.llvm.org
Mon Oct 14 13:17:44 PDT 2024
https://github.com/lntue updated https://github.com/llvm/llvm-project/pull/112235
>From 454d63777aff1d32029d65d14f744fb4ecd815e5 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Mon, 14 Oct 2024 17:00:17 +0000
Subject: [PATCH] [libc][math] Fix issignaling macro usage in the
implementation.
---
libc/src/__support/FPUtil/BasicOperations.h | 3 ++-
libc/src/math/generic/issignaling.cpp | 2 +-
libc/src/math/generic/issignalingf.cpp | 2 +-
libc/src/math/generic/issignalingf128.cpp | 2 +-
libc/src/math/generic/issignalingf16.cpp | 2 +-
libc/src/math/generic/issignalingl.cpp | 2 +-
6 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index a69bca6acc5123..2357b053b60b85 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -247,8 +247,9 @@ LIBC_INLINE T fdim(T x, T y) {
return (x > y ? x - y : 0);
}
+// Avoid reusing `issignaling` macro.
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE int issignaling(const T &x) {
+LIBC_INLINE int issignaling_impl(const T &x) {
FPBits<T> sx(x);
return sx.is_signaling_nan();
}
diff --git a/libc/src/math/generic/issignaling.cpp b/libc/src/math/generic/issignaling.cpp
index 0687a32817b295..657be5ec501566 100644
--- a/libc/src/math/generic/issignaling.cpp
+++ b/libc/src/math/generic/issignaling.cpp
@@ -14,7 +14,7 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, issignaling, (double x)) {
- return fputil::issignaling(x);
+ return fputil::issignaling_impl(x);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/issignalingf.cpp b/libc/src/math/generic/issignalingf.cpp
index 410bf7b4d42782..8a8003a2609dc7 100644
--- a/libc/src/math/generic/issignalingf.cpp
+++ b/libc/src/math/generic/issignalingf.cpp
@@ -14,7 +14,7 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, issignalingf, (float x)) {
- return fputil::issignaling(x);
+ return fputil::issignaling_impl(x);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/issignalingf128.cpp b/libc/src/math/generic/issignalingf128.cpp
index 29612ccf677f67..adf0ebac85bd04 100644
--- a/libc/src/math/generic/issignalingf128.cpp
+++ b/libc/src/math/generic/issignalingf128.cpp
@@ -14,7 +14,7 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, issignalingf128, (float128 x)) {
- return fputil::issignaling(x);
+ return fputil::issignaling_impl(x);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/issignalingf16.cpp b/libc/src/math/generic/issignalingf16.cpp
index 976b8e2b689b3c..68a771e7f898b5 100644
--- a/libc/src/math/generic/issignalingf16.cpp
+++ b/libc/src/math/generic/issignalingf16.cpp
@@ -14,7 +14,7 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, issignalingf16, (float16 x)) {
- return fputil::issignaling(x);
+ return fputil::issignaling_impl(x);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/issignalingl.cpp b/libc/src/math/generic/issignalingl.cpp
index a3959bcae23575..b993c5559461e0 100644
--- a/libc/src/math/generic/issignalingl.cpp
+++ b/libc/src/math/generic/issignalingl.cpp
@@ -14,7 +14,7 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, issignalingl, (long double x)) {
- return fputil::issignaling(x);
+ return fputil::issignaling_impl(x);
}
} // namespace LIBC_NAMESPACE_DECL
More information about the libc-commits
mailing list