[Bf-blender-cvs] [3815c3a324e] blender-v2.79a-release: Revert "BLI_utildefines: Support SWAP macro with two args"
Campbell Barton
noreply at git.blender.org
Fri Jan 5 00:19:29 CET 2018
Commit: 3815c3a324ef81673b2136903107e2da4b637cb5
Author: Campbell Barton
Date: Thu Nov 23 15:19:24 2017 +1100
Branches: blender-v2.79a-release
https://developer.blender.org/rB3815c3a324ef81673b2136903107e2da4b637cb5
Revert "BLI_utildefines: Support SWAP macro with two args"
This reverts commit d749320e3b10161430bc4cb7dd92edb63712bf8c.
It's possible the container struct is larger,
we could do sizeof checks that falls back to memmove
but rather avoid complicating things.
===================================================================
M source/blender/blenlib/BLI_utildefines.h
===================================================================
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index f3860c78b5c..6d958306000 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -163,24 +163,15 @@ extern "C" {
/* some math and copy defines */
-#define _VA_SWAP3(type, a, b) { \
- CHECK_TYPE(a, type); \
- CHECK_TYPE(b, type); \
- type SWAP = (a); \
- (a) = (b); \
- (b) = SWAP; \
-} (void)0
-
-#define _VA_SWAP2(a, b) { \
- CHECK_TYPE_PAIR(a, b); \
- struct { char a_[sizeof(a)]; } SWAP, *a_ = (void *)&(a), *b_ = (void *)&(b); \
- SWAP = *a_; \
- *a_ = *b_; \
- *b_ = SWAP; \
-} ((void)0)
-/* SWAP with two or three args (initial type argument is optional) */
-#define SWAP(...) VA_NARGS_CALL_OVERLOAD(_VA_SWAP, __VA_ARGS__)
+#define SWAP(type, a, b) { \
+ type sw_ap; \
+ CHECK_TYPE(a, type); \
+ CHECK_TYPE(b, type); \
+ sw_ap = (a); \
+ (a) = (b); \
+ (b) = sw_ap; \
+} (void)0
/* swap with a temp value */
#define SWAP_TVAL(tval, a, b) { \
More information about the Bf-blender-cvs
mailing list