Line data Source code
1 : #include "fd_murmur3.h" 2 : 3 : static uint 4 : fd_murmur3_32_( void const * _data, 5 : ulong sz, 6 318418131 : uint seed ) { 7 : 8 318418131 : uchar const * data = _data; 9 318418131 : uint sz_tag = (uint)sz; 10 : 11 318418131 : uint c1 = 0xcc9e2d51U; 12 318418131 : uint c2 = 0x1b873593U; 13 318418131 : int r1 = 15; 14 318418131 : int r2 = 13; 15 318418131 : uint m = 5; 16 318418131 : uint n = 0xe6546b64U; 17 : 18 318418131 : uint hash = seed; 19 : 20 1729792001 : while( sz>=4 ) { 21 1411373870 : uint k = FD_LOAD( uint, data ); 22 1411373870 : k *= c1; 23 1411373870 : k = fd_uint_rotate_left( k, r1 ); 24 1411373870 : k *= c2; 25 : 26 1411373870 : hash ^= k; 27 1411373870 : hash = fd_uint_rotate_left( hash, r2 ); 28 1411373870 : hash = hash*m + n; 29 : 30 1411373870 : data+=4UL; 31 1411373870 : sz -=4UL; 32 1411373870 : } 33 : 34 318418131 : uint rem = 0; 35 318418131 : switch( sz ) { 36 1614171 : case 3: rem ^= (uint)data[2]<<16U; __attribute__((fallthrough)); 37 2861076 : case 2: rem ^= (uint)data[1]<<8U; __attribute__((fallthrough)); 38 9421200 : case 1: rem ^= (uint)data[0]; 39 9421200 : rem *= c1; 40 9421200 : rem = fd_uint_rotate_left( rem, r1 ); 41 9421200 : rem *= c2; 42 9421200 : hash ^= rem; __attribute__((fallthrough)); 43 318418131 : case 0: break; 44 318418131 : } 45 : 46 318418131 : hash ^= sz_tag; 47 318418131 : hash ^= hash>>16U; 48 318418131 : hash *= 0x85ebca6bU; 49 318418131 : hash ^= hash>>13U; 50 318418131 : hash *= 0xc2b2ae35U; 51 318418131 : hash ^= hash>>16U; 52 : 53 318418131 : return hash; 54 318418131 : } 55 : 56 : uint 57 : fd_murmur3_32( void const * _data, 58 : ulong sz, 59 318418131 : uint seed ) { 60 318418131 : return fd_murmur3_32_( _data, sz, seed ); 61 318418131 : }