diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-06-24 15:59:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-06-24 16:14:22 +0400 |
commit | 77616cbe1150293ee04880e71bc1bd71ba4e4204 (patch) | |
tree | 3038ca3f63982a46a052bfff9eaf48b8531924ca /source/blender/blenlib/BLI_utildefines.h | |
parent | 0bc94f8c7ddf1dcc5f2ff385b42da70e2c7da6db (diff) |
add STACK_REMOVE macro
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 600476b9038..4333ef1ce3f 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); \ |