diff options
author | 宋文武 <[email protected]> | 2023-08-19 05:02:00 +0800 |
---|---|---|
committer | 宋文武 <[email protected]> | 2023-08-19 05:02:00 +0800 |
commit | 597af70fd24eb85a85fa8c45008c9cfa241f4d0b (patch) | |
tree | 981c2f4cb803f5a3d33d50f132ecc114373c17a0 /gnu/packages/patches/grantlee-fix-i586-precision.patch | |
parent | 0d70012efb3d19cf9ba955b5df493f193af0ca7e (diff) | |
parent | f3f02dd9c8dce60db0abd84100000edc0b07b6c1 (diff) |
Merge branch 'kde-updates'
Diffstat (limited to 'gnu/packages/patches/grantlee-fix-i586-precision.patch')
-rw-r--r-- | gnu/packages/patches/grantlee-fix-i586-precision.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gnu/packages/patches/grantlee-fix-i586-precision.patch b/gnu/packages/patches/grantlee-fix-i586-precision.patch new file mode 100644 index 0000000000..f3d4384b5b --- /dev/null +++ b/gnu/packages/patches/grantlee-fix-i586-precision.patch @@ -0,0 +1,40 @@ +From 13094b78a790786030a468453c2b3ead4c7fd9cf Mon Sep 17 00:00:00 2001 +From: Fabian Vogt <[email protected]> +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..a0381c59 100644 +--- a/templates/lib/util.cpp ++++ b/templates/lib/util.cpp +@@ -23,6 +23,7 @@ + #include "metaenumvariable_p.h" + #include "metatype.h" + ++#include <cfloat> + #include <QtCore/QStringList> + + QString Grantlee::unescapeStringLiteral(const QString &input) +@@ -212,7 +213,13 @@ std::pair<qreal, QString> 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; |