From 2cf63fb90d16a586e6618e4b5ccdcdc60e855612 Mon Sep 17 00:00:00 2001 From: lucaderi Date: Wed, 1 Jul 2020 11:22:06 +0200 Subject: [PATCH] Compilation fix --- src/pearson.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pearson.c b/src/pearson.c index 882e105..d635662 100644 --- a/src/pearson.c +++ b/src/pearson.c @@ -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 // follows machine-specific endianess in memory 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; - uint16_t hash_mask = 0x0100; - - for (size_t i = 0; i < len; i++) { - // broadcast the character, xor into hash, make them different permutations - uint16_t c = (uint8_t)in[i]; - c |= c << 8; - hash ^= c ^ hash_mask; - // table lookup - hash = t[(uint8_t)hash] + (t[hash >> 8] << 8); - } - // output - return hash; + for (i = 0; i < len; i++) { + // broadcast the character, xor into hash, make them different permutations + uint16_t c = (uint8_t)in[i]; + c |= c << 8; + hash ^= c ^ hash_mask; + // table lookup + hash = t[(uint8_t)hash] + (t[hash >> 8] << 8); + } + // output + return hash; }