diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-27 23:54:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-27 23:54:50 +0300 |
commit | a4965249ec035953249abd2bdc47a86c764f4040 (patch) | |
tree | accafdb3ffdcdf52fa5a3860d8637317b8666923 | |
parent | f478c2cfbd3861cfca1d1a019066d30a4410a1f7 (diff) |
Math Lib: add range_vn_u
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 9c8a9f54379..82a2b9c9ab2 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -314,6 +314,7 @@ double len_squared_vn(const float *array, const int size) ATTR_WARN_UNUSED_RESUL float normalize_vn_vn(float *array_tar, const float *array_src, const int size); float normalize_vn(float *array_tar, const int size); void range_vn_i(int *array_tar, const int size, const int start); +void range_vn_u(unsigned int *array_tar, const int size, const unsigned int start); void range_vn_fl(float *array_tar, const int size, const float start, const float step); void negate_vn(float *array_tar, const int size); void negate_vn_vn(float *array_tar, const float *array_src, const int size); diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index e9909cef29d..8f536bfe75c 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -897,6 +897,16 @@ void range_vn_i(int *array_tar, const int size, const int start) } } +void range_vn_u(unsigned int *array_tar, const int size, const unsigned int start) +{ + unsigned int *array_pt = array_tar + (size - 1); + unsigned int j = start + (unsigned int)(size - 1); + int i = size; + while (i--) { + *(array_pt--) = j--; + } +} + void range_vn_fl(float *array_tar, const int size, const float start, const float step) { float *array_pt = array_tar + (size - 1); |