FastLED 3.9.15
Loading...
Searching...
No Matches

◆ MurmurHash3_x86_32()

static u32 fl::MurmurHash3_x86_32 ( const void * key,
fl::size len,
u32 seed = 0 )
inlinestatic

Definition at line 23 of file hash.h.

24 {
25
27 FL_DISABLE_WARNING_IMPLICIT_FALLTHROUGH;
28
29 const fl::u8 *data = static_cast<const fl::u8 *>(key);
30 const int nblocks = int(len / 4);
31
32 u32 h1 = seed;
33 const u32 c1 = 0xcc9e2d51;
34 const u32 c2 = 0x1b873593;
35
36 // body
37 const u32 *blocks = reinterpret_cast<const u32 *>(data);
38 for (int i = 0; i < nblocks; ++i) {
39 u32 k1 = blocks[i];
40 k1 *= c1;
41 k1 = (k1 << 15) | (k1 >> 17);
42 k1 *= c2;
43
44 h1 ^= k1;
45 h1 = (h1 << 13) | (h1 >> 19);
46 h1 = h1 * 5 + 0xe6546b64;
47 }
48
49 // tail
50 const fl::u8 *tail = data + (nblocks * 4);
51 u32 k1 = 0;
52 switch (len & 3) {
53 case 3:
54 k1 ^= u32(tail[2]) << 16;
55 case 2:
56 k1 ^= u32(tail[1]) << 8;
57 case 1:
58 k1 ^= u32(tail[0]);
59 k1 *= c1;
60 k1 = (k1 << 15) | (k1 >> 17);
61 k1 *= c2;
62 h1 ^= k1;
63 }
64
65 // finalization
66 h1 ^= u32(len);
67 // fmix32
68 h1 ^= h1 >> 16;
69 h1 *= 0x85ebca6b;
70 h1 ^= h1 >> 13;
71 h1 *= 0xc2b2ae35;
72 h1 ^= h1 >> 16;
73
74 return h1;
75
77}
#define FL_DISABLE_WARNING_PUSH
#define FL_DISABLE_WARNING_POP
unsigned char u8
Definition int.h:17

References FL_DISABLE_WARNING_POP, and FL_DISABLE_WARNING_PUSH.

Referenced by fl::FastHash< vec2< T > >::operator()(), fl::Hash< double >::operator()(), fl::Hash< FFT_Args >::operator()(), fl::Hash< fl::string >::operator()(), fl::Hash< fl::WeakPtr< T > >::operator()(), fl::Hash< Key >::operator()(), fl::Hash< T * >::operator()(), and fl::Hash< vec2< T > >::operator()().

+ Here is the caller graph for this function: