diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-08-05 02:04:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-08-05 02:06:19 +0400 |
commit | 6b6ea0485f3fee08f87af80caf8f7d3a2b3792cb (patch) | |
tree | 821817b13ddcd4f36b8106487b5fc7c532a364b4 /source/blender/blenlib/BLI_utildefines.h | |
parent | e4a13e40eb39cb35934132ffd9183869a8d8abc5 (diff) |
Macros: replace UNPACK#OP -> UNPACK#_EX, allow suffix
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 6a9eb64a686..683b3c4c438 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -379,13 +379,13 @@ #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(op, a) op((a)[0]), op((a)[1]) -#define UNPACK3OP(op, a) op((a)[0]), op((a)[1]), op((a)[2]) -#define UNPACK4OP(op, a) op((a)[0]), op((a)[1]), op((a)[2]), op((a)[3]) +#define UNPACK2(a) ((a)[0]), ((a)[1]) +#define UNPACK3(a) UNPACK2(a), ((a)[2]) +#define UNPACK4(a) UNPACK3(a), ((a)[3]) +/* pre may be '&', '*' or func, post may be '->member' */ +#define UNPACK2_EX(pre, a, post) (pre((a)[0])post), (pre((a)[1])post) +#define UNPACK3_EX(pre, a, post) UNPACK2_EX(pre, a, post), (pre((a)[2])post) +#define UNPACK4_EX(pre, a, post) UNPACK3_EX(pre, a, post), (pre((a)[3])post) /* array helpers */ #define ARRAY_LAST_ITEM(arr_start, arr_dtype, tot) \ |