[libc-commits] [PATCH] D119142: [libc][NFC] moving template specialization outside class declaration
Guillaume Chatelet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Feb 7 07:19:36 PST 2022
gchatelet created this revision.
gchatelet added a reviewer: lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added a project: libc-project.
gchatelet requested review of this revision.
This is necessary to get llvm-libc compile with GCC.
This patch is extracted from D119002 <https://reviews.llvm.org/D119002>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D119142
Files:
libc/utils/MPFRWrapper/MPFRUtils.cpp
Index: libc/utils/MPFRWrapper/MPFRUtils.cpp
===================================================================
--- libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -386,16 +386,6 @@
// These functions are useful for debugging.
template <typename T> T as() const;
- template <> float as<float>() const {
- return mpfr_get_flt(value, mpfr_rounding);
- }
- template <> double as<double>() const {
- return mpfr_get_d(value, mpfr_rounding);
- }
- template <> long double as<long double>() const {
- return mpfr_get_ld(value, mpfr_rounding);
- }
-
void dump(const char *msg) const { mpfr_printf("%s%.128Rf\n", msg, value); }
// Return the ULP (units-in-the-last-place) difference between the
@@ -482,6 +472,18 @@
}
};
+template <> float MPFRNumber::as<float>() const {
+ return mpfr_get_flt(value, mpfr_rounding);
+}
+
+template <> double MPFRNumber::as<double>() const {
+ return mpfr_get_d(value, mpfr_rounding);
+}
+
+template <> long double MPFRNumber::as<long double>() const {
+ return mpfr_get_ld(value, mpfr_rounding);
+}
+
namespace internal {
template <typename InputType>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119142.406457.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220207/acf5c429/attachment.bin>
More information about the libc-commits
mailing list