[libc-commits] [libc] 3caef46 - [libc][NFC] Enforce internal linkage for exp* support functions. (#76250)

via libc-commits libc-commits at lists.llvm.org
Tue Jan 2 10:47:17 PST 2024


Author: lntue
Date: 2024-01-02T13:47:13-05:00
New Revision: 3caef46631190fe24b16704fd22185a3083949a5

URL: https://github.com/llvm/llvm-project/commit/3caef46631190fe24b16704fd22185a3083949a5
DIFF: https://github.com/llvm/llvm-project/commit/3caef46631190fe24b16704fd22185a3083949a5.diff

LOG: [libc][NFC] Enforce internal linkage for exp* support functions. (#76250)

Added: 
    

Modified: 
    libc/src/math/generic/exp.cpp
    libc/src/math/generic/exp10.cpp
    libc/src/math/generic/exp2.cpp
    libc/src/math/generic/expm1.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/math/generic/exp.cpp b/libc/src/math/generic/exp.cpp
index 5428a04430887f..c8e36404a7812c 100644
--- a/libc/src/math/generic/exp.cpp
+++ b/libc/src/math/generic/exp.cpp
@@ -51,6 +51,8 @@ constexpr double MLOG_2_EXP2_M12_MID = 0x1.718432a1b0e26p-47;
 constexpr double MLOG_2_EXP2_M12_MID_30 = 0x1.718432ap-47;
 constexpr double MLOG_2_EXP2_M12_LO = 0x1.b0e2633fe0685p-79;
 
+namespace {
+
 // Polynomial approximations with double precision:
 // Return expm1(dx) / x ~ 1 + dx / 2 + dx^2 / 6 + dx^3 / 24.
 // For |dx| < 2^-13 + 2^-30:
@@ -218,6 +220,8 @@ double set_exceptional(double x) {
   return x + static_cast<double>(FPBits::inf());
 }
 
+} // namespace
+
 LLVM_LIBC_FUNCTION(double, exp, (double x)) {
   using FPBits = typename fputil::FPBits<double>;
   using FloatProp = typename fputil::FloatProperties<double>;

diff  --git a/libc/src/math/generic/exp10.cpp b/libc/src/math/generic/exp10.cpp
index aa66d4f17a3a02..92b3a468a9cc97 100644
--- a/libc/src/math/generic/exp10.cpp
+++ b/libc/src/math/generic/exp10.cpp
@@ -52,6 +52,8 @@ constexpr double ERR_D = 0x1.8p-63;
 // Errors when using double-double precision.
 constexpr double ERR_DD = 0x1.8p-99;
 
+namespace {
+
 // Polynomial approximations with double precision.  Generated by Sollya with:
 // > P = fpminimax((10^x - 1)/x, 3, [|D...|], [-2^-14, 2^-14]);
 // > P;
@@ -268,6 +270,8 @@ double set_exceptional(double x) {
   return x + static_cast<double>(FPBits::inf());
 }
 
+} // namespace
+
 LLVM_LIBC_FUNCTION(double, exp10, (double x)) {
   using FPBits = typename fputil::FPBits<double>;
   using FloatProp = typename fputil::FloatProperties<double>;

diff  --git a/libc/src/math/generic/exp2.cpp b/libc/src/math/generic/exp2.cpp
index 3e9f9c6855c436..44aeb14e231bf2 100644
--- a/libc/src/math/generic/exp2.cpp
+++ b/libc/src/math/generic/exp2.cpp
@@ -42,6 +42,8 @@ constexpr double ERR_D = 0x1.8p-63;
 // Errors when using double-double precision.
 constexpr double ERR_DD = 0x1.0p-100;
 
+namespace {
+
 // Polynomial approximations with double precision.  Generated by Sollya with:
 // > P = fpminimax((2^x - 1)/x, 3, [|D...|], [-2^-13 - 2^-30, 2^-13 + 2^-30]);
 // > P;
@@ -243,6 +245,8 @@ double set_exceptional(double x) {
   return x + static_cast<double>(FPBits::inf());
 }
 
+} // namespace
+
 LLVM_LIBC_FUNCTION(double, exp2, (double x)) {
   using FPBits = typename fputil::FPBits<double>;
   using FloatProp = typename fputil::FloatProperties<double>;

diff  --git a/libc/src/math/generic/expm1.cpp b/libc/src/math/generic/expm1.cpp
index e7cc240839759c..deb3b0adc0eadd 100644
--- a/libc/src/math/generic/expm1.cpp
+++ b/libc/src/math/generic/expm1.cpp
@@ -61,6 +61,8 @@ constexpr double MLOG_2_EXP2_M12_MID = 0x1.718432a1b0e26p-47;
 constexpr double MLOG_2_EXP2_M12_MID_30 = 0x1.718432ap-47;
 constexpr double MLOG_2_EXP2_M12_LO = 0x1.b0e2633fe0685p-79;
 
+namespace {
+
 // Polynomial approximations with double precision:
 // Return expm1(dx) / x ~ 1 + dx / 2 + dx^2 / 6 + dx^3 / 24.
 // For |dx| < 2^-13 + 2^-30:
@@ -269,6 +271,8 @@ double set_exceptional(double x) {
   return x + static_cast<double>(FPBits::inf());
 }
 
+} // namespace
+
 LLVM_LIBC_FUNCTION(double, expm1, (double x)) {
   using FPBits = typename fputil::FPBits<double>;
   using FloatProp = typename fputil::FloatProperties<double>;


        


More information about the libc-commits mailing list