aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoïc Blot <loic.blot@unix-experience.fr>2017-07-27 17:12:18 +0200
committerLoïc Blot <loic.blot@unix-experience.fr>2017-07-27 17:12:18 +0200
commite9d70057994172d1b1f52c1ae40842de82a55f86 (patch)
tree31cfa4ee2adeeaae5826bce170ac04796e89f7f5 /src
parent2015aaba96bdc6a95448e942b6a007d6ed3cddae (diff)
downloadminetest-e9d70057994172d1b1f52c1ae40842de82a55f86.tar.gz
minetest-e9d70057994172d1b1f52c1ae40842de82a55f86.tar.bz2
minetest-e9d70057994172d1b1f52c1ae40842de82a55f86.zip
Revert "Noise::perlinMap2D,3D: replace a loop init with a single memset call"
This reverts commit bc1654feedc90caa8c26328ca6f0fc59fbe5b76c.
Diffstat (limited to 'src')
-rw-r--r--src/noise.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/noise.cpp b/src/noise.cpp
index e68c5ce16..f67771b88 100644
--- a/src/noise.cpp
+++ b/src/noise.cpp
@@ -713,7 +713,8 @@ float *Noise::perlinMap2D(float x, float y, float *persistence_map)
if (persistence_map) {
if (!persist_buf)
persist_buf = new float[bufsize];
- memset(persist_buf, 1.0f, sizeof(float) * bufsize);
+ for (size_t i = 0; i != bufsize; i++)
+ persist_buf[i] = 1.0;
}
for (size_t oct = 0; oct < np.octaves; oct++) {
@@ -750,8 +751,8 @@ float *Noise::perlinMap3D(float x, float y, float z, float *persistence_map)
if (persistence_map) {
if (!persist_buf)
persist_buf = new float[bufsize];
-
- memset(persist_buf, 1.0f, sizeof(float) * bufsize);
+ for (size_t i = 0; i != bufsize; i++)
+ persist_buf[i] = 1.0;
}
for (size_t oct = 0; oct < np.octaves; oct++) {