1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +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

@ -205,7 +205,7 @@ inline float MapgenCarpathian::getLerp(float noise1, float noise2, float mod)
float MapgenCarpathian::getSteps(float noise)
{
float w = 0.5f;
float k = floor(noise / w);
float k = std::floor(noise / w);
float f = (noise - k * w) / w;
float s = std::fmin(2.f * f, 1.f);
return (k + s) * w;
@ -342,8 +342,8 @@ float MapgenCarpathian::terrainLevelAtPoint(s16 x, s16 z)
std::fmax(std::fmin(hill1, hill2), std::fmin(hill3, hill4));
// Rolling hills
float hill_mnt = hilliness * pow(n_hills, 2.f);
float hills = pow(hter, 3.f) * hill_mnt;
float hill_mnt = hilliness * std::pow(n_hills, 2.f);
float hills = std::pow(hter, 3.f) * hill_mnt;
// Ridged mountains
float ridge_mnt = hilliness * (1.f - std::fabs(n_ridge_mnt));