From bc35aadc204351c534ac3ac66712d838b291b5dd Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 13 Dec 2024 17:45:05 +0100 Subject: [PATCH] trivial: replace macro cube() by inline function/template Avoids funky side effects. The old version would have failed horribly for innocent invocations such as "cube(a+b)" or "cube(++a)". Signed-off-by: Berthold Stoeger --- core/deco.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/deco.cpp b/core/deco.cpp index 3a9a92651..066dfd128 100644 --- a/core/deco.cpp +++ b/core/deco.cpp @@ -28,7 +28,11 @@ #include "planner.h" #include "qthelper.h" -#define cube(x) (x * x * x) +template +T cube(T x) +{ + return x * x * x; +} // Subsurface until v4.6.2 appeared to produce marginally less conservative plans than our benchmarks. // This factor was used to correct this. Since a fix for the saturation and desaturation rates