diff options
author | kwolekr <kwolekr@minetest.net> | 2015-11-01 11:16:18 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-11-01 11:16:18 -0500 |
commit | d198e420ec54be47fe2285b3205953282ec06742 (patch) | |
tree | 9cb8f150ebb0c84b3db5f86e70ee7aad2be01f3d /src/util/timetaker.h | |
parent | 9269a0ecc7267822bc5ac5af95ad4977bdc94fec (diff) | |
download | minetest-d198e420ec54be47fe2285b3205953282ec06742.tar.gz minetest-d198e420ec54be47fe2285b3205953282ec06742.tar.bz2 minetest-d198e420ec54be47fe2285b3205953282ec06742.zip |
Fix Noise compiled under clang >= 3.7.x with -O2 or higher
When compiled with optimizations, the most recent versions of clang seem
to 'optimize' out a crucial "and %reg, 0x7FFFFFFF" instruction in noise2d(),
probably because it somehow assumed the variable n would never become greater
than that amount.
Indeed, signed integer underflow is undefined behavior in C and C++, so while
this optimization is "correct" in that sense, it breaks lots of existing code.
Solved by changing n to an unsigned type, making behavior well-defined.
Diffstat (limited to 'src/util/timetaker.h')
0 files changed, 0 insertions, 0 deletions