diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-12 21:44:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-12 21:44:10 +0400 |
commit | 9a92cd80087d5d8158c6af27d2ae3d2da4856ef0 (patch) | |
tree | 9f7ebaeac7d2529e05136411855867a14e10feea /source/blender/blenlib/intern/smallhash.c | |
parent | 9099e59da86b26c9d360b59dd5c8de769dfa0c4f (diff) |
bmesh minor refactor
* add DM_to_bmesh_ex, DM_to_bmesh for converting a derived mesh to a BMesh (rather than a BMEditMesh)
* have a generic variable for allocsize: bm_mesh_allocsize_default, rather than copying the values about.
Diffstat (limited to 'source/blender/blenlib/intern/smallhash.c')
-rw-r--r-- | source/blender/blenlib/intern/smallhash.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index 785b196f013..aaa518d3e1c 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -25,9 +25,10 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include <string.h> + #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -#include <string.h> #include "BLI_smallhash.h" @@ -43,7 +44,7 @@ #define SMHASH_CELL_FREE ((void *)0x7FFFFFFD) #define SMHASH_NONZERO(n) ((n) + !(n)) -#define SMHASH_NEXT(h, hoff) ABS(((h) + ((hoff=SMHASH_NONZERO(hoff*2)+1), hoff))) +#define SMHASH_NEXT(h, hoff) ABS(((h) + ((hoff = SMHASH_NONZERO(hoff * 2) + 1), hoff))) extern unsigned int hashsizes[]; @@ -60,7 +61,7 @@ void BLI_smallhash_init(SmallHash *hash) hash->copytable = hash->_copytable; hash->stacktable = hash->_stacktable; - for (i=0; i<hash->size; i++) { + for (i = 0; i < hash->size; i++) { hash->table[i].val = SMHASH_CELL_FREE; } } @@ -98,11 +99,11 @@ void BLI_smallhash_insert(SmallHash *hash, uintptr_t key, void *item) hash->size = newsize; - for (i=0; i<hash->size; i++) { + for (i = 0; i < hash->size; i++) { hash->table[i].val = SMHASH_CELL_FREE; } - for (i=0; i<hashsizes[hash->curhash-1]; i++) { + for (i = 0; i<hashsizes[hash->curhash - 1]; i++) { if (ELEM(tmp[i].val, SMHASH_CELL_UNUSED, SMHASH_CELL_FREE)) { continue; } @@ -228,7 +229,7 @@ void *BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key) iter->i++; - return iter->hash->table[iter->i-1].val; + return iter->hash->table[iter->i - 1].val; } iter->i++; |