gentoo-ebuilds/sci-mathematics/mathmod/files/mathmod-13.0-fix_cxx20.patch
Nicolas PARLANT 8a76450ae9
sci-mathematics/mathmod: fix gcc-16/gnu++20
lerp is declared globally with c++20 which is by default with gcc-16 and
allowed by qt-6.10

Closes: https://bugs.gentoo.org/967323
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/44999
Closes: https://github.com/gentoo/gentoo/pull/44999
Signed-off-by: Sam James <sam@gentoo.org>
2025-12-15 16:23:17 +00:00

42 lines
1.3 KiB
Diff

PR merged https://github.com/parisolab/mathmod/pull/293.patch
lerp is declared globally with c++20 which is by default with gcc-16 and
allowed by qt-6.10
--- a/pariso/commun.cpp
+++ b/pariso/commun.cpp
@@ -20,6 +20,11 @@
#include "commun.h"
+#if defined(__cpp_lib_interpolate)
+#include <cmath> // for std::lerp (C++20)
+using std::lerp;
+#endif
+
float rd[3], featurePoint[4];
const static uint OFFSET_BASIS = 2166136261U;
const static uint FNV_PRIME = 16777619U;
@@ -423,10 +428,12 @@ float fade(float f)
{
return f*f*f*(f*(f*6-15)+10); // t * t * (3.0 - 2.0 * t);
}
+#if !defined(__cpp_lib_interpolate)
float lerp(float t, float a, float b)
{
return a + t*(b - a);
}
+#endif
float grad(int hash, float x, float y, float z)
{
int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
--- a/pariso/commun.h
+++ b/pariso/commun.h
@@ -36,7 +36,9 @@ double Laguerre_a(const double*);
void ImprovedNoise(float xsize=4.0, float ysize=4.0, float zsize=4.0);
float noise(float, float, float);
float fade(float);
+#if !defined(__cpp_lib_interpolate)
float lerp(float, float, float);
+#endif
float grad(int, float, float, float);
float FractalNoise3D(float, float, float, int, float, float);
float Marble(float, float, float, int);