[libc-commits] [PATCH] D157449: [libc] Fix final conversion warnings
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Aug 8 16:08:53 PDT 2023
michaelrj updated this revision to Diff 548392.
michaelrj marked 2 inline comments as done.
michaelrj added a comment.
update tanhf signs array
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157449/new/
https://reviews.llvm.org/D157449
Files:
libc/src/math/generic/exp2f.cpp
libc/src/math/generic/tanhf.cpp
libc/src/time/difftime.cpp
Index: libc/src/time/difftime.cpp
===================================================================
--- libc/src/time/difftime.cpp
+++ libc/src/time/difftime.cpp
@@ -12,7 +12,7 @@
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(double, difftime, (time_t end, time_t beginning)) {
- return end - beginning;
+ return static_cast<double>(end - beginning);
}
} // namespace __llvm_libc
Index: libc/src/math/generic/tanhf.cpp
===================================================================
--- libc/src/math/generic/tanhf.cpp
+++ libc/src/math/generic/tanhf.cpp
@@ -56,7 +56,7 @@
if (LIBC_UNLIKELY(xbits.is_nan()))
return x + 1.0f; // sNaN to qNaN + signal
- const double SIGNS[2][2] = {{1.0f, -0x1.0p-25f}, {-1.0f, 0x1.0p-25f}};
+ constexpr float SIGNS[2][2] = {{1.0f, -0x1.0p-25f}, {-1.0f, 0x1.0p-25f}};
bool sign = xbits.get_sign();
int idx = static_cast<int>(sign);
Index: libc/src/math/generic/exp2f.cpp
===================================================================
--- libc/src/math/generic/exp2f.cpp
+++ libc/src/math/generic/exp2f.cpp
@@ -65,7 +65,7 @@
double c2 = fputil::multiply_add(xd, COEFFS[5], COEFFS[4]);
double p = fputil::polyeval(xsq, c0, c1, c2);
double r = fputil::multiply_add(p, xd, 1.0);
- return r;
+ return static_cast<float>(r);
}
// x >= 128
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157449.548392.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230808/ef2f84b0/attachment.bin>
More information about the libc-commits
mailing list