spielwiese
Last change
on this file since 54b24c was
54b24c,
checked in by Reimer Behrends <behrends@…>, 5 years ago
|
Finalizing thread support.
|
-
Property mode set to
100644
|
File size:
628 bytes
|
Line | |
---|
1 | #pragma once |
---|
2 | |
---|
3 | Word Hash(const char *addr, Int n); |
---|
4 | Word Hash(Str *str); |
---|
5 | Word Hash(const char *str); |
---|
6 | Word Hash(Word w); |
---|
7 | Word Hash(Int w); |
---|
8 | |
---|
9 | #define FIB_HASH_MULT_32 ((Word32) 0x9e3779b9) |
---|
10 | |
---|
11 | static inline Word32 FibHash(Word32 w) { |
---|
12 | return w * FIB_HASH_MULT_32; |
---|
13 | } |
---|
14 | |
---|
15 | static inline Word32 FibHash(Word32 w, int bits) { |
---|
16 | return (w * FIB_HASH_MULT_32) >> (32 - bits); |
---|
17 | } |
---|
18 | |
---|
19 | #ifdef HAVE_64BIT_SUPPORT |
---|
20 | #define FIB_HASH_MULT_64 ((Word64) 0x9e3779b97f4a7c13) |
---|
21 | |
---|
22 | static inline Word64 FibHash(Word64 w) { |
---|
23 | return w * FIB_HASH_MULT_64; |
---|
24 | } |
---|
25 | |
---|
26 | static inline Word64 FibHash(Word64 w, int bits) { |
---|
27 | return (w * FIB_HASH_MULT_64) >> (64 - bits); |
---|
28 | } |
---|
29 | |
---|
30 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.