X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fcrc.c;h=90d3041c3fa3d7d606efb54b285929c8adaed5e8;hb=7c7750f02368b570353ea109f23a0ea26d226e02;hp=ed22adc46dd868c97120384db7a19abeb31ec714;hpb=8fce86636639afaeac4ca0e869e8bcd833324a62;p=m6w6%2Flibmemcached diff --git a/libmemcached/crc.c b/libmemcached/crc.c index ed22adc4..90d3041c 100644 --- a/libmemcached/crc.c +++ b/libmemcached/crc.c @@ -76,12 +76,11 @@ static const uint32_t crc32tab[256] = { uint32_t hash_crc32(const char *key, size_t key_length) { - uint32_t x; - uint32_t crc; - crc= ~0; + uint64_t x; + uint32_t crc= UINT32_MAX; for (x= 0; x < key_length; x++) - crc= (crc >> 8) ^ crc32tab[(crc ^ (key[x])) & 0xff]; + crc= (crc >> 8) ^ crc32tab[(crc ^ (uint64_t)key[x]) & 0xff]; return ~crc; }