[Bf-blender-cvs] [a496524] master: Math Lib: add range_vn_u

Campbell Barton noreply at git.blender.org
Mon Apr 27 22:55:04 CEST 2015


Commit: a4965249ec035953249abd2bdc47a86c764f4040
Author: Campbell Barton
Date:   Tue Apr 28 06:54:17 2015 +1000
Branches: master
https://developer.blender.org/rBa4965249ec035953249abd2bdc47a86c764f4040

Math Lib: add range_vn_u

===================================================================

M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/math_vector.c

===================================================================

diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 9c8a9f5..82a2b9c 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 e9909ce..8f536bf 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);




More information about the Bf-blender-cvs mailing list