Skip to content

Commit c28a522

Browse files
committed
[libc][NFC] moving template specialization outside class declaration
This is necessary to get llvm-libc compile with GCC. This patch is extracted from D119002. Differential Revision: https://reviews.llvm.org/D119142
1 parent f21dd70 commit c28a522

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

libc/utils/MPFRWrapper/MPFRUtils.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,6 @@ class MPFRNumber {
392392
// These functions are useful for debugging.
393393
template <typename T> T as() const;
394394

395-
template <> float as<float>() const {
396-
return mpfr_get_flt(value, mpfr_rounding);
397-
}
398-
template <> double as<double>() const {
399-
return mpfr_get_d(value, mpfr_rounding);
400-
}
401-
template <> long double as<long double>() const {
402-
return mpfr_get_ld(value, mpfr_rounding);
403-
}
404-
405395
void dump(const char *msg) const { mpfr_printf("%s%.128Rf\n", msg, value); }
406396

407397
// Return the ULP (units-in-the-last-place) difference between the
@@ -488,6 +478,18 @@ class MPFRNumber {
488478
}
489479
};
490480

481+
template <> float MPFRNumber::as<float>() const {
482+
return mpfr_get_flt(value, mpfr_rounding);
483+
}
484+
485+
template <> double MPFRNumber::as<double>() const {
486+
return mpfr_get_d(value, mpfr_rounding);
487+
}
488+
489+
template <> long double MPFRNumber::as<long double>() const {
490+
return mpfr_get_ld(value, mpfr_rounding);
491+
}
492+
491493
namespace internal {
492494

493495
template <typename InputType>

0 commit comments

Comments
 (0)