diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-29 16:54:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-29 16:59:48 +0300 |
commit | 3acc1ba49c95786841608c0b516a7fd0879bad76 (patch) | |
tree | 5e8ed01aa9716eb42d9f38bdca1e0c6df31c9455 /source/blender/blenlib | |
parent | d6b28bbb1d61f059ec28156fb275393ee3389d57 (diff) |
Add macro BLI_SMALLSTACK_AS_TABLE
Use for edge-split (a little less overhead compare to popping each item).
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_linklist_stack.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_linklist_stack.h b/source/blender/blenlib/BLI_linklist_stack.h index 9ac233a8fa4..a4b8f77bfa6 100644 --- a/source/blender/blenlib/BLI_linklist_stack.h +++ b/source/blender/blenlib/BLI_linklist_stack.h @@ -168,6 +168,16 @@ #define BLI_SMALLSTACK_IS_EMPTY(var) \ ((_BLI_SMALLSTACK_CAST(var) _##var##_stack) == NULL) +/* fill in a lookup table */ +#define BLI_SMALLSTACK_AS_TABLE(var, data) \ +{ \ + LinkNode *_##var##_iter; \ + unsigned int i; \ + for (_##var##_iter = _##var##_stack, i = 0; _##var##_iter; _##var##_iter = _##var##_iter->next, i++) { \ + (data)[i] = _BLI_SMALLSTACK_CAST(var) (_##var##_iter->link); \ + } \ +} ((void)0) + /* loop over stack members last-added-first */ #define BLI_SMALLSTACK_ITER_BEGIN(var, item) \ { \ |