From fc4df5a4b79d327309147c6201fcb9eab1d8623a Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 5 Jan 2023 23:49:11 -0600 Subject: user/grantlee: Use x87 math properly Reported upstream by SuSE maintainer, though the way this works does sort of bother me since this sort of code really shouldn't depend on precision if written properly.. Fixes: #954 --- user/grantlee/APKBUILD | 7 +++++-- user/grantlee/x87fpu.patch | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 user/grantlee/x87fpu.patch (limited to 'user/grantlee') diff --git a/user/grantlee/APKBUILD b/user/grantlee/APKBUILD index f1dca5388..df8bad208 100644 --- a/user/grantlee/APKBUILD +++ b/user/grantlee/APKBUILD @@ -12,7 +12,9 @@ depends_dev="qt5-qtbase-dev" makedepends="cmake $depends_dev qt5-qtscript-dev doxygen graphviz qt5-qtdeclarative-dev" subpackages="$pkgname-dev $pkgname-doc" -source="https://github.com/steveire/$pkgname/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz" +source="https://github.com/steveire/$pkgname/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz + x87fpu.patch + " build() { if [ "$CBUILD" != "$CHOST" ]; then @@ -39,4 +41,5 @@ package() { mv "$builddir"/apidox "$pkgdir"/usr/share/doc/grantlee/ } -sha512sums="dc7192fe0553954fffc3e2c584e4fdd80fc1f22d25846cacc5f2dcd1db2673ca62464c8492a4ed3bfc9dfc3e62ef13322809dd29bd56fa4a3a153a8d373ddde5 grantlee-5.3.1.tar.gz" +sha512sums="dc7192fe0553954fffc3e2c584e4fdd80fc1f22d25846cacc5f2dcd1db2673ca62464c8492a4ed3bfc9dfc3e62ef13322809dd29bd56fa4a3a153a8d373ddde5 grantlee-5.3.1.tar.gz +b515403727416ef91037e5774a78e4b477e4e99da0c58e53f3099a6f8558c25244416acabd2bde529aafa509c4a61c54761d39fdaceb756bc4b638ccc3285607 x87fpu.patch" diff --git a/user/grantlee/x87fpu.patch b/user/grantlee/x87fpu.patch new file mode 100644 index 000000000..f439bf1f1 --- /dev/null +++ b/user/grantlee/x87fpu.patch @@ -0,0 +1,42 @@ +Upstream-URL: https://github.com/steveire/grantlee/pull/86 + +From 7e34ffaff40fc085a15bb0ffabb5f247795581fd Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Sun, 13 Nov 2022 14:01:21 +0100 +Subject: [PATCH] Fix formatting of some larger file sizes on 32bit x86 + +With the x87 FPU available, GCC uses long double precision for some variables. +Due to the function call passing a double, some comparisons break down. +That resulted in "1.00 YB" being printed as "1000.00 ZB" instead. + +Fixes #85 +--- + templates/lib/util.cpp | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/templates/lib/util.cpp b/templates/lib/util.cpp +index 504674a7..5924cdf5 100644 +--- a/templates/lib/util.cpp ++++ b/templates/lib/util.cpp +@@ -23,6 +23,7 @@ + #include "metaenumvariable_p.h" + #include "metatype.h" + ++#include + #include + + QString Grantlee::unescapeStringLiteral(const QString &input) +@@ -212,7 +213,13 @@ std::pair Grantlee::calcFileSize(qreal size, int unitSystem, + bool found = false; + int count = 0; + const qreal baseVal = (_unitSystem == 10) ? 1000.0F : 1024.0F; ++#if FLT_EVAL_METHOD == 2 ++ // Avoid that this is treated as long double, as the increased ++ // precision breaks the comparison below. ++ volatile qreal current = 1.0F; ++#else + qreal current = 1.0F; ++#endif + int units = decimalUnits.size(); + while (!found && (count < units)) { + current *= baseVal; -- cgit v1.2.3-70-g09d2