mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
Compilation fix
This commit is contained in:
parent
ff689f9b72
commit
2cf63fb90d
|
@ -224,18 +224,18 @@ void pearson_hash_128 (uint8_t *out, const uint8_t *in, size_t len) {
|
||||||
// 16-bit hash: the return value has to be interpreted as uint16_t and
|
// 16-bit hash: the return value has to be interpreted as uint16_t and
|
||||||
// follows machine-specific endianess in memory
|
// follows machine-specific endianess in memory
|
||||||
uint16_t pearson_hash_16 (const uint8_t *in, size_t len) {
|
uint16_t pearson_hash_16 (const uint8_t *in, size_t len) {
|
||||||
|
size_t i;
|
||||||
|
uint16_t hash = 0;
|
||||||
|
uint16_t hash_mask = 0x0100;
|
||||||
|
|
||||||
uint16_t hash = 0;
|
for (i = 0; i < len; i++) {
|
||||||
uint16_t hash_mask = 0x0100;
|
// broadcast the character, xor into hash, make them different permutations
|
||||||
|
uint16_t c = (uint8_t)in[i];
|
||||||
for (size_t i = 0; i < len; i++) {
|
c |= c << 8;
|
||||||
// broadcast the character, xor into hash, make them different permutations
|
hash ^= c ^ hash_mask;
|
||||||
uint16_t c = (uint8_t)in[i];
|
// table lookup
|
||||||
c |= c << 8;
|
hash = t[(uint8_t)hash] + (t[hash >> 8] << 8);
|
||||||
hash ^= c ^ hash_mask;
|
}
|
||||||
// table lookup
|
// output
|
||||||
hash = t[(uint8_t)hash] + (t[hash >> 8] << 8);
|
return hash;
|
||||||
}
|
|
||||||
// output
|
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user