diff options
author | Hans Goudey <h.goudey@me.com> | 2022-02-17 21:36:41 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-17 21:36:41 +0300 |
commit | 48432c1c92824a0da4bb73b1ca7b45290a4b3aaf (patch) | |
tree | 8485d15a5f7d8b4941b34940bb3d9c02e3dac129 /source/blender/blenlib/BLI_math_vector.hh | |
parent | b6fe1b0c658f5068154f9e4a726de789f5ebb68a (diff) |
Fix: Debug build error with vector type division
The idea is to keep `is_any_zero` in the `blender::math` namespace,
so instead of trying to be clever, just move it there and expand the
function where it was used in the class.
Diffstat (limited to 'source/blender/blenlib/BLI_math_vector.hh')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.hh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.hh b/source/blender/blenlib/BLI_math_vector.hh index 3bb89bb26b2..7c848eeb145 100644 --- a/source/blender/blenlib/BLI_math_vector.hh +++ b/source/blender/blenlib/BLI_math_vector.hh @@ -39,6 +39,16 @@ template<typename T, int Size> inline bool is_zero(const vec_base<T, Size> &a) return true; } +template<typename T, int Size> inline bool is_any_zero(const vec_base<T, Size> &a) +{ + for (int i = 0; i < Size; i++) { + if (a[i] == T(0)) { + return true; + } + } + return false; +} + template<typename T, int Size> inline vec_base<T, Size> abs(const vec_base<T, Size> &a) { vec_base<T, Size> result; |