diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-15 08:39:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-15 08:40:33 +0400 |
commit | aa10cf7f5cc3b2acdc0fd79b0eecccae029afcfa (patch) | |
tree | bc1b692349a746590eb3ec1cba89a3bfe675e0ab /source/blender/blenlib/intern/BLI_ghash.c | |
parent | cad4bfe653e12bb4c6178b7a83d35806d10ee9b0 (diff) |
GHash: add BLI_ghashutil_uinthash_v4 for hashing 4 ints at once
Diffstat (limited to 'source/blender/blenlib/intern/BLI_ghash.c')
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 33a3ba30e4b..4849ef3e958 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -679,6 +679,19 @@ int BLI_ghashutil_ptrcmp(const void *a, const void *b) return (a < b) ? -1 : 1; } +unsigned int BLI_ghashutil_uinthash_v4(const unsigned int key[4]) +{ + unsigned int hash; + hash = key[0]; + hash *= 37; + hash += key[1]; + hash *= 37; + hash += key[2]; + hash *= 37; + hash += key[3]; + return hash; +} + unsigned int BLI_ghashutil_uinthash(unsigned int key) { key += ~(key << 16); |