From 9e365069afe156f33fadfad9705e1325f894cd54 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Dec 2021 20:01:44 +1100 Subject: Cleanup: move public doc-strings into headers for 'blenlib' - Added space below non doc-string comments to make it clear these aren't comments for the symbols directly below them. - Use doxy sections for some headers. - Minor improvements to doc-strings. Ref T92709 --- source/blender/blenlib/intern/BLI_ghash_utils.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'source/blender/blenlib/intern/BLI_ghash_utils.c') diff --git a/source/blender/blenlib/intern/BLI_ghash_utils.c b/source/blender/blenlib/intern/BLI_ghash_utils.c index b9144009304..f8e621e406c 100644 --- a/source/blender/blenlib/intern/BLI_ghash_utils.c +++ b/source/blender/blenlib/intern/BLI_ghash_utils.c @@ -46,9 +46,10 @@ uint BLI_ghashutil_ptrhash(const void *key) return (uint)(intptr_t)key; } #else -/* Based Python3.7's pointer hashing function. */ uint BLI_ghashutil_ptrhash(const void *key) { + /* Based Python3.7's pointer hashing function. */ + size_t y = (size_t)key; /* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid * excessive hash collisions for dicts and sets */ @@ -134,15 +135,6 @@ size_t BLI_ghashutil_combine_hash(size_t hash_a, size_t hash_b) return hash_a ^ (hash_b + 0x9e3779b9 + (hash_a << 6) + (hash_a >> 2)); } -/** - * This function implements the widely used "djb" hash apparently posted - * by Daniel Bernstein to comp.lang.c some time ago. The 32 bit - * unsigned hash value starts at 5381 and for each byte 'c' in the - * string, is updated: `hash = hash * 33 + c`. - * This function uses the signed value of each byte. - * - * NOTE: this is the same hash method that glib 2.34.0 uses. - */ uint BLI_ghashutil_strhash_n(const char *key, size_t n) { const signed char *p; -- cgit v1.2.3