projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
This includes work for partitioning by key. Dormando wished for these methods.
[m6w6/libmemcached]
/
lib
/
crc.c
diff --git
a/lib/crc.c
b/lib/crc.c
index ec7e0d44971dce9fe3b8e807fc1ffa21a9077fba..ed22adc46dd868c97120384db7a19abeb31ec714 100644
(file)
--- 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;
{
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;
}
return ~crc;
}