6 #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
7 #define get16bits(d) (*((const uint16_t *) (d)))
10 #if !defined (get16bits)
11 #define get16bits(d) ((((const uint8_t *)(d))[1] << UINT32_C(8))\
12 +((const uint8_t *)(d))[0])
15 uint32_t hashfn(
const char * data,
int len) {
16 uint32_t hash = len, tmp;
19 if (len <= 0 || data == NULL)
return 0;
25 for (;len > 0; len--) {
26 hash += get16bits (data);
27 tmp = (get16bits (data+2) << 11) ^ hash;
28 hash = (hash << 16) ^ tmp;
29 data += 2*
sizeof (uint16_t);
35 case 3: hash += get16bits (data);
37 hash ^= data[
sizeof (uint16_t)] << 18;
40 case 2: hash += get16bits (data);
44 case 1: hash += *data;