mame: work around long double on powerpc64
On powerpc64 the long double type is special in that it does not permit a constexpr return type for a function where a long double constant and a double constant are multiplied. Yet this is what the MAME _MHz_XTAL and _GHz_XTAL constexpr suffixes on numbers expect from the multiplication of a long double value with 1e6 or 1e9 respectively. To make the code compile, knowing it will produce differing results for e.g. 6'144'000_Hz_XTAL and 6.144_MHz_XTAL, cast the long double constant down to double before multiplying by 1e6 or 1e9. Do this iff the preprocessor macro _GLIBCXX_LONG_DOUBLE_COMPAT is defined.
This commit is contained in:
parent
3cd0d74422
commit
8d95441bcf
1 changed files with 16 additions and 0 deletions
16
srcpkgs/mame/patches/ppc-long_double.patch
Normal file
16
srcpkgs/mame/patches/ppc-long_double.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
--- src/emu/xtal.h 2020-12-30 16:46:10.000000000 +0100
|
||||
+++ src/emu/xtal.h 2020-12-31 13:41:51.679447004 +0100
|
||||
@@ -81,8 +81,13 @@
|
||||
constexpr XTAL operator *(double mult, const XTAL &xtal) { return XTAL(xtal.base(), mult * xtal.dvalue()); }
|
||||
|
||||
constexpr XTAL operator ""_Hz_XTAL(long double clock) { return XTAL(double(clock)); }
|
||||
+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
|
||||
+constexpr XTAL operator ""_kHz_XTAL(long double clock) { return XTAL(double(clock) * 1e3); }
|
||||
+constexpr XTAL operator ""_MHz_XTAL(long double clock) { return XTAL(double(clock) * 1e6); }
|
||||
+#else
|
||||
constexpr XTAL operator ""_kHz_XTAL(long double clock) { return XTAL(double(clock * 1e3)); }
|
||||
constexpr XTAL operator ""_MHz_XTAL(long double clock) { return XTAL(double(clock * 1e6)); }
|
||||
+#endif
|
||||
|
||||
constexpr XTAL operator ""_Hz_XTAL(unsigned long long clock) { return XTAL(double(clock)); }
|
||||
constexpr XTAL operator ""_kHz_XTAL(unsigned long long clock) { return XTAL(double(clock) * 1e3); }
|
Loading…
Reference in a new issue