Fix FTBFS on power "not a constant expression"
authorDebian Games Team <pkg-games-devel@lists.alioth.debian.org>
Tue, 21 Apr 2026 11:41:16 +0000 (13:41 +0200)
committerJordi Mallach <jordi@debian.org>
Tue, 21 Apr 2026 11:41:16 +0000 (13:41 +0200)
There are some explanation upstream :
https://github.com/mamedev/mame/issues/3157

There are some explanation upstream :
https://github.com/mamedev/mame/issues/3157
and this probably due to the fact that IBM 128bit long double format
is not constant folded.
I slighlty rewrote ""_kHz_XTAL(long double clock) and ""_MHz_XTAL(long double clock)
the way ""_kHz_XTAL(unsigned long long clock) and ""_MHz_XTAL(unsigned long long clock)
which makes the compiler happy.
Also including an upstream change about rounding to get same results as on x86
: https://github.com/mamedev/mame/pull/5164
Author: Frédéric Bonnard <frediz@debian.org>

Gbp-Pq: Name fix-922619.patch

src/emu/xtal.h

index 69cfbe9043383fbde811911d2d355870202cbe85..85c31832c6b43b63d5fdc2b2a592f2548996695f 100644 (file)
@@ -83,8 +83,8 @@ constexpr XTAL operator *(unsigned int mult, const XTAL &xtal) { return XTAL(xta
 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)); }
-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)); }
+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); }
 
 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); }