diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-16 02:20:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-16 02:20:18 +0400 |
commit | e2fe7751d6ce07b6fa9f30a395444bd78cd62d46 (patch) | |
tree | 730a4dcc6e161fd45a66262b03fbe3410395edd9 /source/blender/blenlib/BLI_utildefines.h | |
parent | 104a7bfb90cfb7ae4fa477a031172bd6694afb43 (diff) |
code cleanup: replace most DO_MINMAX2 -> minmax_v2v2_v2
also add UNPACK macros's. handy for printing vectors for eg.
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 056fa916da1..a22aa0c13d7 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -257,6 +257,15 @@ #define IN_RANGE(a, b, c) ((b < c) ? ((b < a && a < c) ? 1 : 0) : ((c < a && a < b) ? 1 : 0)) #define IN_RANGE_INCL(a, b, c) ((b < c) ? ((b <= a && a <= c) ? 1 : 0) : ((c <= a && a <= b) ? 1 : 0)) +/* unpack vector for args */ +#define UNPACK2(a) ((a)[0]), ((a)[1]) +#define UNPACK3(a) ((a)[0]), ((a)[1]), ((a)[2]) +#define UNPACK4(a) ((a)[0]), ((a)[1]), ((a)[2]), ((a)[3]) +/* op may be '&' or '*' */ +#define UNPACK2OP(a, op) op((a)[0]), op((a)[1]) +#define UNPACK3OP(a, op) op((a)[0]), op((a)[1]), op((a)[2]) +#define UNPACK4OP(a, op) op((a)[0]), op((a)[1]), op((a)[2]), op((a)[3]) + /* array helpers */ #define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) \ (arr_dtype *)((char *)arr_start + (elem_size * (tot - 1))) |