summaryrefslogtreecommitdiff
path: root/src/procgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/procgen.cpp')
-rw-r--r--src/procgen.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/procgen.cpp b/src/procgen.cpp
index 09ccae5..b5e1d6f 100644
--- a/src/procgen.cpp
+++ b/src/procgen.cpp
@@ -63,8 +63,9 @@ float perlin_noise_t::get(float x, float y, float scale)
x /= scale;
y /= scale;
- nx = mod<ssize_t>(floor(x), size);
- ny = mod<ssize_t>(floor(y), size);
+ nx = (ssize_t)floor(x) & (size - 1);
+ ny = (ssize_t)floor(y) & (size - 1);
+
nx1 = (nx == size - 1 ? 0 : nx + 1);
ny1 = (ny == size - 1 ? 0 : ny + 1);