diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/io/file_access_compressed.cpp | 3 | ||||
-rw-r--r-- | core/math/math_funcs.h | 12 |
2 files changed, 8 insertions, 7 deletions
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index 6c4310a572..102cd9cf6c 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -208,7 +208,8 @@ void FileAccessCompressed::seek(size_t p_position) { if (p_position == read_total) { at_end = true; } else { - + at_end = false; + read_eof = false; int block_idx = p_position / block_size; if (block_idx != read_block) { diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index a712356ddc..af845ca01e 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -255,16 +255,16 @@ public: static _ALWAYS_INLINE_ float round(float p_val) { return (p_val >= 0) ? Math::floor(p_val + 0.5) : -Math::floor(-p_val + 0.5); } static _ALWAYS_INLINE_ int64_t wrapi(int64_t value, int64_t min, int64_t max) { - int64_t rng = max - min; - return (rng != 0) ? min + ((((value - min) % rng) + rng) % rng) : min; + int64_t range = max - min; + return range == 0 ? min : min + ((((value - min) % range) + range) % range); } static _ALWAYS_INLINE_ double wrapf(double value, double min, double max) { - double rng = max - min; - return (!is_equal_approx(rng, 0.0)) ? value - (rng * Math::floor((value - min) / rng)) : min; + double range = max - min; + return is_zero_approx(range) ? min : value - (range * Math::floor((value - min) / range)); } static _ALWAYS_INLINE_ float wrapf(float value, float min, float max) { - float rng = max - min; - return (!is_equal_approx(rng, 0.0f)) ? value - (rng * Math::floor((value - min) / rng)) : min; + float range = max - min; + return is_zero_approx(range) ? min : value - (range * Math::floor((value - min) / range)); } // double only, as these functions are mainly used by the editor and not performance-critical, |