[Bf-blender-cvs] [77616cb] master: add STACK_REMOVE macro

Campbell Barton noreply at git.blender.org
Tue Jun 24 14:34:49 CEST 2014


Commit: 77616cbe1150293ee04880e71bc1bd71ba4e4204
Author: Campbell Barton
Date:   Tue Jun 24 21:59:38 2014 +1000
https://developer.blender.org/rB77616cbe1150293ee04880e71bc1bd71ba4e4204

add STACK_REMOVE macro

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

M	source/blender/blenlib/BLI_utildefines.h

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

diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 600476b..4333ef1 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -343,6 +343,11 @@
 #define STACK_POP_PTR(stack)        ((_##stack##_index) ? &((stack)[--(_##stack##_index)]) : NULL)
 #define STACK_POP_DEFAULT(stack, r) ((_##stack##_index) ?  ((stack)[--(_##stack##_index)]) : r)
 #define STACK_FREE(stack)      ((void)stack)
+/* take care, re-orders */
+#define STACK_REMOVE(stack, i) \
+	if (--_##stack##_index != i) { \
+		stack[i] = stack[_##stack##_index]; \
+	} (void)0
 #ifdef __GNUC__
 #define STACK_SWAP(stack_a, stack_b) { \
 	SWAP(typeof(stack_a), stack_a, stack_b); \




More information about the Bf-blender-cvs mailing list