diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-07 05:38:32 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-07 05:38:32 +0400 |
commit | 96d73bfdcfd74bfccd58bf02ae25b64577fce904 (patch) | |
tree | 76f1423cdb1fe3079bd6b17c071c3c4a496c6550 /source/blender/blenlib | |
parent | 85540d5aa7abb487e546b5483fffeef2e6075af5 (diff) |
replace VECCOPY with copy_v3_v3, same for 2d copy, also added vec copy functions for int & char.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 9 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 44 |
2 files changed, 52 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index e259071a27a..2b9d6d2d6d6 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -54,11 +54,18 @@ MINLINE void swap_v2_v2(float a[2], float b[2]); MINLINE void swap_v3_v3(float a[3], float b[3]); MINLINE void swap_v4_v4(float a[4], float b[4]); +/* char */ +MINLINE void copy_v2_v2_char(char r[2], const char a[2]); +MINLINE void copy_v3_v3_char(char r[3], const char a[3]); +MINLINE void copy_v4_v4_char(char r[4], const char a[4]); /* short */ MINLINE void copy_v2_v2_short(short r[2], const short a[2]); MINLINE void copy_v3_v3_short(short r[3], const short a[3]); MINLINE void copy_v4_v4_short(short r[4], const short a[4]); - +/* int */ +MINLINE void copy_v2_v2_int(int r[2], const int a[2]); +MINLINE void copy_v3_v3_int(int r[3], const int a[3]); +MINLINE void copy_v4_v4_int(int r[4], const int a[4]); /********************************* Arithmetic ********************************/ diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index c460b69679b..1c7d131c750 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -78,6 +78,28 @@ MINLINE void copy_v4_v4(float r[4], const float a[4]) } /* short */ +MINLINE void copy_v2_v2_char(char r[2], const char a[2]) +{ + r[0]= a[0]; + r[1]= a[1]; +} + +MINLINE void copy_v3_v3_char(char r[3], const char a[3]) +{ + r[0]= a[0]; + r[1]= a[1]; + r[2]= a[2]; +} + +MINLINE void copy_v4_v4_char(char r[4], const char a[4]) +{ + r[0]= a[0]; + r[1]= a[1]; + r[2]= a[2]; + r[3]= a[3]; +} + +/* short */ MINLINE void copy_v2_v2_short(short r[2], const short a[2]) { r[0]= a[0]; @@ -99,6 +121,28 @@ MINLINE void copy_v4_v4_short(short r[4], const short a[4]) r[3]= a[3]; } +/* int */ +MINLINE void copy_v2_v2_int(int r[2], const int a[2]) +{ + r[0]= a[0]; + r[1]= a[1]; +} + +MINLINE void copy_v3_v3_int(int r[3], const int a[3]) +{ + r[0]= a[0]; + r[1]= a[1]; + r[2]= a[2]; +} + +MINLINE void copy_v4_v4_int(int r[4], const int a[4]) +{ + r[0]= a[0]; + r[1]= a[1]; + r[2]= a[2]; + r[3]= a[3]; +} + MINLINE void swap_v2_v2(float a[2], float b[2]) { SWAP(float, a[0], b[0]); |