1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +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

@ -345,7 +345,7 @@ void OreBlob::generate(MMVManip *vm, int mapseed, u32 blockseed,
float ydist = (s32)y1 - (s32)csize / 2;
float zdist = (s32)z1 - (s32)csize / 2;
noiseval -= (sqrt(xdist * xdist + ydist * ydist + zdist * zdist) / csize);
noiseval -= std::sqrt(xdist * xdist + ydist * ydist + zdist * zdist) / csize;
if (noiseval < nthresh)
continue;
@ -469,7 +469,7 @@ void OreStratum::generate(MMVManip *vm, int mapseed, u32 blockseed,
noise_stratum_thickness->result[index] : (float)stratum_thickness) /
2.0f;
float nmid = noise->result[index];
y0 = MYMAX(nmin.Y, ceil(nmid - nhalfthick));
y0 = MYMAX(nmin.Y, std::ceil(nmid - nhalfthick));
y1 = MYMIN(nmax.Y, nmid + nhalfthick);
} else { // Simple horizontal stratum
y0 = nmin.Y;