diff options
Diffstat (limited to 'source/blender/blenlib/intern/voxel.c')
-rw-r--r-- | source/blender/blenlib/intern/voxel.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index 3a8705bbbba..bc775cb8f0c 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -56,15 +56,18 @@ float BLI_voxel_sample_nearest(float *data, const int res[3], const float co[3]) return D(data, res, xi, yi, zi); } -// returns highest integer <= x as integer (slightly faster than floor()) +/* returns highest integer <= x as integer (slightly faster than floor()) */ BLI_INLINE int FLOORI(float x) { const int r = (int)x; return ((x >= 0.f) || (float)r == x) ? r : (r - 1); } -// clamp function, cannot use the CLAMPIS macro, it sometimes returns unwanted results apparently related to gcc optimization flag -fstrict-overflow which is enabled at -O2 -// this causes the test (x + 2) < 0 with int x == 2147483647 to return false (x being an integer, x + 2 should wrap around to -2147483647 so the test < 0 should return true, which it doesn't) +/* clamp function, cannot use the CLAMPIS macro, it sometimes returns unwanted results apparently related to + * gcc optimization flag -fstrict-overflow which is enabled at -O2 + * + * this causes the test (x + 2) < 0 with int x == 2147483647 to return false (x being an integer, + * x + 2 should wrap around to -2147483647 so the test < 0 should return true, which it doesn't) */ BLI_INLINE int _clamp(int a, int b, int c) { return (a < b) ? b : ((a > c) ? c : a); |