1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix many issues reported by clang-tidy (#7189)

* Fix many issues reported by clang-tidy

We have many issues in code related to some performance to float <-> double.
Clang-tidy reported it in performance-type-promotion-in-math-fn

I fixed many of them. It's not ready for a promote to blocking

Also fix some value which should be const-ref
This commit is contained in:
Loïc Blot 2018-04-02 23:51:08 +02:00 committed by GitHub
parent e98fd934ce
commit 2481ea27ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 61 additions and 52 deletions

View file

@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "test.h"
#include <cmath>
#include "exceptions.h"
#include "noise.h"
@ -61,7 +62,7 @@ void TestNoise::testNoise2dPoint()
for (u32 x = 0; x != 10; x++, i++) {
float actual = NoisePerlin2D(&np_normal, x, y, 1337);
float expected = expected_2d_results[i];
UASSERT(fabs(actual - expected) <= 0.00001);
UASSERT(std::fabs(actual - expected) <= 0.00001);
}
}
@ -74,7 +75,7 @@ void TestNoise::testNoise2dBulk()
for (u32 i = 0; i != 10 * 10; i++) {
float actual = noisevals[i];
float expected = expected_2d_results[i];
UASSERT(fabs(actual - expected) <= 0.00001);
UASSERT(std::fabs(actual - expected) <= 0.00001);
}
}
@ -88,7 +89,7 @@ void TestNoise::testNoise3dPoint()
for (u32 x = 0; x != 10; x++, i++) {
float actual = NoisePerlin3D(&np_normal, x, y, z, 1337);
float expected = expected_3d_results[i];
UASSERT(fabs(actual - expected) <= 0.00001);
UASSERT(std::fabs(actual - expected) <= 0.00001);
}
}
@ -101,7 +102,7 @@ void TestNoise::testNoise3dBulk()
for (u32 i = 0; i != 10 * 10 * 10; i++) {
float actual = noisevals[i];
float expected = expected_3d_results[i];
UASSERT(fabs(actual - expected) <= 0.00001);
UASSERT(std::fabs(actual - expected) <= 0.00001);
}
}