diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-21 19:48:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-21 19:53:48 +0400 |
commit | 4ae7ae6f2e49287f4565b8bd6bec486f37a826af (patch) | |
tree | fad0aeb96fdd585951bb775262dd1f97193830a4 /source/blender/blenlib/intern/smallhash.c | |
parent | 70ce11d640e0a85c863db08f269167a75c0eb251 (diff) |
Code Cleanup: use bool for return values and correct comments
also remove CDDM_Check, theres no need for it.
Diffstat (limited to 'source/blender/blenlib/intern/smallhash.c')
-rw-r--r-- | source/blender/blenlib/intern/smallhash.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index 9790ce1f0b4..b6924af5d8f 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -27,6 +27,11 @@ /** \file blender/blenlib/intern/smallhash.c * \ingroup bli + * + * A light stack-friendly hash library, it uses stack space for smallish hash tables + * but falls back to heap memory once the stack limits reached. + * + * based on a doubling non-chaining approach */ #include <string.h> @@ -35,6 +40,7 @@ #include "BLI_utildefines.h" #include "BLI_smallhash.h" + #include "BLI_strict_flags.h" /* SMHASH_CELL_UNUSED means this cell is inside a key series, @@ -43,7 +49,7 @@ * no chance of anyone shoving INT32_MAX-2 into a *val pointer, I * imagine. hopefully. * - * note: these have the SMHASH suffix because we may want to make them public. + * note: these have the SMHASH prefix because we may want to make them public. */ #define SMHASH_CELL_UNUSED ((void *)0x7FFFFFFF) #define SMHASH_CELL_FREE ((void *)0x7FFFFFFD) @@ -191,7 +197,7 @@ void *BLI_smallhash_lookup(SmallHash *hash, uintptr_t key) } -int BLI_smallhash_haskey(SmallHash *hash, uintptr_t key) +bool BLI_smallhash_haskey(SmallHash *hash, uintptr_t key) { unsigned int h = (unsigned int)(key); unsigned int hoff = 1; @@ -200,7 +206,7 @@ int BLI_smallhash_haskey(SmallHash *hash, uintptr_t key) (hash->table[h % hash->size].val == SMHASH_CELL_UNUSED)) { if (hash->table[h % hash->size].val == SMHASH_CELL_FREE) { - return 0; + return false; } h = SMHASH_NEXT(h, hoff); |