| /* SPDX-License-Identifier: LGPL-2.1 |
| * Based on Paul Hsieh's (LGPG 2.1) hash function |
| * From: http://www.azillionmonkeys.com/qed/hash.html |
| #define get16bits(d) (*((const __u16 *) (d))) |
| __u32 SuperFastHash (const char *data, int len, __u32 initval) { |
| if (len <= 0 || data == NULL) return 0; |
| #pragma clang loop unroll(full) |
| hash += get16bits (data); |
| tmp = (get16bits (data+2) << 11) ^ hash; |
| hash = (hash << 16) ^ tmp; |
| data += 2*sizeof (__u16); |
| case 3: hash += get16bits (data); |
| hash ^= ((signed char)data[sizeof (__u16)]) << 18; |
| case 2: hash += get16bits (data); |
| case 1: hash += (signed char)*data; |
| /* Force "avalanching" of final 127 bits */ |