diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-11-13 20:00:01 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-11-13 20:00:01 +0100 |
commit | 944fdd173f40c0fcc718d6aa2af191bf993adc70 (patch) | |
tree | 28436adf7e20c58427c8d48685d944b964e11147 /src/Noise | |
parent | Merge pull request #3430 from cuberite/Overrides (diff) | |
download | cuberite-944fdd173f40c0fcc718d6aa2af191bf993adc70.tar cuberite-944fdd173f40c0fcc718d6aa2af191bf993adc70.tar.gz cuberite-944fdd173f40c0fcc718d6aa2af191bf993adc70.tar.bz2 cuberite-944fdd173f40c0fcc718d6aa2af191bf993adc70.tar.lz cuberite-944fdd173f40c0fcc718d6aa2af191bf993adc70.tar.xz cuberite-944fdd173f40c0fcc718d6aa2af191bf993adc70.tar.zst cuberite-944fdd173f40c0fcc718d6aa2af191bf993adc70.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Noise/Noise.h | 2 | ||||
-rw-r--r-- | src/Noise/OctavedNoise.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h index 03f61643d..d4c56492e 100644 --- a/src/Noise/Noise.h +++ b/src/Noise/Noise.h @@ -269,7 +269,7 @@ NOISE_DATATYPE cNoise::CubicInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE cNoise::CosineInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE a_Pct) { const NOISE_DATATYPE ft = a_Pct * static_cast<NOISE_DATATYPE>(3.1415927); - const NOISE_DATATYPE f = static_cast<NOISE_DATATYPE>(static_cast<NOISE_DATATYPE>(1 - cos(ft)) * static_cast<NOISE_DATATYPE>(0.5)); + const NOISE_DATATYPE f = static_cast<NOISE_DATATYPE>(static_cast<NOISE_DATATYPE>(1 - cos(static_cast<double>(ft))) * static_cast<NOISE_DATATYPE>(0.5)); return a_A * (1 - f) + a_B * f; } diff --git a/src/Noise/OctavedNoise.h b/src/Noise/OctavedNoise.h index 6dd79365f..0b1a25549 100644 --- a/src/Noise/OctavedNoise.h +++ b/src/Noise/OctavedNoise.h @@ -61,7 +61,7 @@ public: std::unique_ptr<NOISE_DATATYPE[]> workspaceHeap; if (a_Workspace == nullptr) { - workspaceHeap.reset(new NOISE_DATATYPE[a_SizeX * a_SizeY]); + workspaceHeap.reset(new NOISE_DATATYPE[static_cast<size_t>(a_SizeX * a_SizeY)]); a_Workspace = workspaceHeap.get(); } @@ -121,7 +121,7 @@ public: std::unique_ptr<NOISE_DATATYPE[]> workspaceHeap; if (a_Workspace == nullptr) { - workspaceHeap.reset(new NOISE_DATATYPE[a_SizeX * a_SizeY * a_SizeZ]); + workspaceHeap.reset(new NOISE_DATATYPE[static_cast<size_t>(a_SizeX * a_SizeY * a_SizeZ)]); a_Workspace = workspaceHeap.get(); } |