diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-10 12:52:24 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-10 12:52:24 +0300 |
commit | 88d5d99130d31d8126c00af4966bdd164ed1c610 (patch) | |
tree | fa4d7d8651ae1c12bfd7bdd7308e9afd4c32b433 /source/blender/blenlib/intern/smallhash.c | |
parent | 5237937a08b52ab44a5683b780a5456f59d28b66 (diff) |
Tweaks to the comments of smallhash
Collaboration between russki guy working from Netherlands and
ausie bloke working from Australia (not Austria).
Diffstat (limited to 'source/blender/blenlib/intern/smallhash.c')
-rw-r--r-- | source/blender/blenlib/intern/smallhash.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index ba336ab6c4b..35c23299877 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -34,6 +34,8 @@ * based on a doubling non-chaining approach which uses more buckets then entries * stepping over buckets when two keys share the same hash so any key can find a free bucket. * + * \warning This should _only_ be used for small hashes where allocating a hash every time is unacceptable. + * Otherwise #GHash should be used instead. * * #SmallHashEntry.key * - ``SMHASH_KEY_UNUSED`` means the key in the cell has not been initialized. @@ -126,7 +128,7 @@ BLI_INLINE SmallHashEntry *smallhash_lookup(const SmallHash *sh, const uintptr_t BLI_assert(key != SMHASH_KEY_UNUSED); - /* note: there are always more buckets then entries, + /* note: there are always more buckets than entries, * so we know there will always be a free bucket if the key isn't found. */ for (e = &sh->buckets[h % sh->nbuckets]; e->val != SMHASH_CELL_FREE; @@ -221,7 +223,7 @@ void BLI_smallhash_init(SmallHash *sh) BLI_smallhash_init_ex(sh, 0); } -/*NOTE: does *not* free *sh itself! only the direct data!*/ +/* NOTE: does *not* free *sh itself! only the direct data! */ void BLI_smallhash_release(SmallHash *sh) { if (sh->buckets != sh->buckets_stack) { |