Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2011-03-18 01:59:54 +0300
committerJoseph Eagar <joeedh@gmail.com>2011-03-18 01:59:54 +0300
commit1216fe7f2134af2bae48e7eab892e34c29af0d28 (patch)
tree983eb94aa36724fbde07310b717e6aae79fc6d35 /source/blender/blenlib/BLI_smallhash.h
parenta147a91899f97adccb7049965a4cd4dfd5693eb6 (diff)
=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.
Diffstat (limited to 'source/blender/blenlib/BLI_smallhash.h')
-rwxr-xr-xsource/blender/blenlib/BLI_smallhash.h19
1 files changed, 14 insertions, 5 deletions
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;