X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fcrc.c;h=ed22adc46dd868c97120384db7a19abeb31ec714;hb=3bd95102380ff8d9f2599f0965c09776344d0691;hp=ec7e0d44971dce9fe3b8e807fc1ffa21a9077fba;hpb=ffe371b7498a26133a892591c7dc56d3e6212d10;p=m6w6%2Flibmemcached diff --git a/lib/crc.c b/lib/crc.c index ec7e0d44..ed22adc4 100644 --- a/lib/crc.c +++ b/lib/crc.c @@ -74,14 +74,14 @@ static const uint32_t crc32tab[256] = { }; -uint32_t hash_crc32(const char *data, size_t data_len) +uint32_t hash_crc32(const char *key, size_t key_length) { uint32_t x; uint32_t crc; - crc = ~0; + crc= ~0; - for (x = 0; x < data_len; x++) - crc = (crc >> 8) ^ crc32tab[(crc ^ (data[x])) & 0xff]; + for (x= 0; x < key_length; x++) + crc= (crc >> 8) ^ crc32tab[(crc ^ (key[x])) & 0xff]; return ~crc; }