summaryrefslogtreecommitdiff
path: root/sci-mathematics/mathmod/files/mathmod-13.0-fix_cxx20.patch
blob: 4610a989f0f97fe261ca650ea8f0e75ad8ba6483 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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);