diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-12 16:23:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-12 16:23:44 +0400 |
commit | 40535f5ef3baaef5ba4d8c1f7abbbb7f1efe3b77 (patch) | |
tree | 0c8e44aa35aee81be56ddb451437147e6b816a0a /source/blender/blenlib | |
parent | 85145db47be6a4b117142ca5370ed0e10104a5cb (diff) |
bmesh recalculate normals - remove BLI_array reallocation, the max size of the array is known.
replace with STACK_* macros (moved to BLI_utildefines.h).
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 1a0073a8f13..a51dcfe197c 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -290,6 +290,14 @@ typedef bool _BLI_Bool; #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]) +/* simple stack */ +#define STACK_DECLARE(stack) unsigned int _##stack##_index +#define STACK_INIT(stack) ((void)stack, (void)((_##stack##_index) = 0)) +#define STACK_SIZE(stack) ((void)stack, (void)(_##stack##_index)) +#define STACK_PUSH(stack, val) (void)((stack)[(_##stack##_index)++] = val) +#define STACK_POP(stack) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : NULL) +#define STACK_FREE(stack) ((void)stack) + /* array helpers */ #define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) \ (arr_dtype *)((char *)arr_start + (elem_size * (tot - 1))) |