From 1216fe7f2134af2bae48e7eab892e34c29af0d28 Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Thu, 17 Mar 2011 22:59:54 +0000 Subject: =bmesh= Bevel! Implemented bevel (from scratch). Man is this tool way cooler then I thought it was. Note that uv/vcol interpolation is working (loop level data) but vert/edge data (like vgroups) likely still needs work. --- source/blender/blenlib/BLI_smallhash.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'source/blender/blenlib/BLI_smallhash.h') diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h index 2ab365eea0e..a9b0e34bf89 100755 --- a/source/blender/blenlib/BLI_smallhash.h +++ b/source/blender/blenlib/BLI_smallhash.h @@ -59,7 +59,7 @@ typedef struct SmallHash { #define CELL_FREE ((void*)0x7FFFFFFD) #define NONZERO(n) ((n) + !(n)) -#define HASHNEXT(h, hoff) ((h) + ((hoff=NONZERO(hoff*2)+1), hoff)) +#define HASHNEXT(h, hoff) ABS(((h) + ((hoff=NONZERO(hoff*2)+1), hoff))) BM_INLINE void BLI_smallhash_init(SmallHash *hash) { @@ -92,7 +92,9 @@ BM_INLINE void BLI_smallhash_release(SmallHash *hash) BM_INLINE void BLI_smallhash_insert(SmallHash *hash, intptr_t key, void *item) { int h, hoff=1; - + + key = ABS(key); + if (hash->size < hash->used*3) { int newsize = hashsizes[++hash->curhash]; entry *tmp; @@ -145,7 +147,10 @@ BM_INLINE void BLI_smallhash_insert(SmallHash *hash, intptr_t key, void *item) BM_INLINE void BLI_smallhash_remove(SmallHash *hash, intptr_t key) { - int h = key, hoff=1; + int h, hoff=1; + + key = ABS(key); + h = key; while (hash->table[h % hash->size].key != key || hash->table[h % hash->size].val == CELL_UNUSED) @@ -162,7 +167,10 @@ BM_INLINE void BLI_smallhash_remove(SmallHash *hash, intptr_t key) BM_INLINE void *BLI_smallhash_lookup(SmallHash *hash, intptr_t key) { - int h = key, hoff=1; + int h, hoff=1; + + key = ABS(key); + h = key; if (!hash->table) return NULL; @@ -181,7 +189,8 @@ BM_INLINE void *BLI_smallhash_lookup(SmallHash *hash, intptr_t key) BM_INLINE int BLI_smallhash_haskey(SmallHash *hash, intptr_t key) { - int h = key, hoff=1; + int h = ABS(key), hoff=1; + key = ABS(key); if (!hash->table) return 0; -- cgit v1.2.3