Noise::perlinMap2D,3D: replace a loop init with a single memset call

This commit is contained in:
Loic Blot 2017-07-27 00:24:14 +02:00
parent c8faee4eda
commit bc1654feed
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
1 changed files with 3 additions and 4 deletions

View File

@ -713,8 +713,7 @@ float *Noise::perlinMap2D(float x, float y, float *persistence_map)
if (persistence_map) {
if (!persist_buf)
persist_buf = new float[bufsize];
for (size_t i = 0; i != bufsize; i++)
persist_buf[i] = 1.0;
memset(persist_buf, 1.0f, sizeof(float) * bufsize);
}
for (size_t oct = 0; oct < np.octaves; oct++) {
@ -751,8 +750,8 @@ float *Noise::perlinMap3D(float x, float y, float z, float *persistence_map)
if (persistence_map) {
if (!persist_buf)
persist_buf = new float[bufsize];
for (size_t i = 0; i != bufsize; i++)
persist_buf[i] = 1.0;
memset(persist_buf, 1.0f, sizeof(float) * bufsize);
}
for (size_t oct = 0; oct < np.octaves; oct++) {