Skip to content

Commit 3caef46

Browse files
authored
[libc][NFC] Enforce internal linkage for exp* support functions. (#76250)
1 parent a2d7af7 commit 3caef46

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

libc/src/math/generic/exp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ constexpr double MLOG_2_EXP2_M12_MID = 0x1.718432a1b0e26p-47;
5151
constexpr double MLOG_2_EXP2_M12_MID_30 = 0x1.718432ap-47;
5252
constexpr double MLOG_2_EXP2_M12_LO = 0x1.b0e2633fe0685p-79;
5353

54+
namespace {
55+
5456
// Polynomial approximations with double precision:
5557
// Return expm1(dx) / x ~ 1 + dx / 2 + dx^2 / 6 + dx^3 / 24.
5658
// For |dx| < 2^-13 + 2^-30:
@@ -218,6 +220,8 @@ double set_exceptional(double x) {
218220
return x + static_cast<double>(FPBits::inf());
219221
}
220222

223+
} // namespace
224+
221225
LLVM_LIBC_FUNCTION(double, exp, (double x)) {
222226
using FPBits = typename fputil::FPBits<double>;
223227
using FloatProp = typename fputil::FloatProperties<double>;

libc/src/math/generic/exp10.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ constexpr double ERR_D = 0x1.8p-63;
5252
// Errors when using double-double precision.
5353
constexpr double ERR_DD = 0x1.8p-99;
5454

55+
namespace {
56+
5557
// Polynomial approximations with double precision. Generated by Sollya with:
5658
// > P = fpminimax((10^x - 1)/x, 3, [|D...|], [-2^-14, 2^-14]);
5759
// > P;
@@ -268,6 +270,8 @@ double set_exceptional(double x) {
268270
return x + static_cast<double>(FPBits::inf());
269271
}
270272

273+
} // namespace
274+
271275
LLVM_LIBC_FUNCTION(double, exp10, (double x)) {
272276
using FPBits = typename fputil::FPBits<double>;
273277
using FloatProp = typename fputil::FloatProperties<double>;

libc/src/math/generic/exp2.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ constexpr double ERR_D = 0x1.8p-63;
4242
// Errors when using double-double precision.
4343
constexpr double ERR_DD = 0x1.0p-100;
4444

45+
namespace {
46+
4547
// Polynomial approximations with double precision. Generated by Sollya with:
4648
// > P = fpminimax((2^x - 1)/x, 3, [|D...|], [-2^-13 - 2^-30, 2^-13 + 2^-30]);
4749
// > P;
@@ -243,6 +245,8 @@ double set_exceptional(double x) {
243245
return x + static_cast<double>(FPBits::inf());
244246
}
245247

248+
} // namespace
249+
246250
LLVM_LIBC_FUNCTION(double, exp2, (double x)) {
247251
using FPBits = typename fputil::FPBits<double>;
248252
using FloatProp = typename fputil::FloatProperties<double>;

libc/src/math/generic/expm1.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ constexpr double MLOG_2_EXP2_M12_MID = 0x1.718432a1b0e26p-47;
6161
constexpr double MLOG_2_EXP2_M12_MID_30 = 0x1.718432ap-47;
6262
constexpr double MLOG_2_EXP2_M12_LO = 0x1.b0e2633fe0685p-79;
6363

64+
namespace {
65+
6466
// Polynomial approximations with double precision:
6567
// Return expm1(dx) / x ~ 1 + dx / 2 + dx^2 / 6 + dx^3 / 24.
6668
// For |dx| < 2^-13 + 2^-30:
@@ -269,6 +271,8 @@ double set_exceptional(double x) {
269271
return x + static_cast<double>(FPBits::inf());
270272
}
271273

274+
} // namespace
275+
272276
LLVM_LIBC_FUNCTION(double, expm1, (double x)) {
273277
using FPBits = typename fputil::FPBits<double>;
274278
using FloatProp = typename fputil::FloatProperties<double>;

0 commit comments

Comments
 (0)