summaryrefslogtreecommitdiff
path: root/src/crc64.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-04-09 12:20:47 +0200
committerantirez <antirez@gmail.com>2012-04-09 12:20:47 +0200
commit88c1d9550d198fd7df426b19ea67e9c51c92a811 (patch)
tree0fe28b732e8f4cbeba09afc4b0e4c466b17c8d3b /src/crc64.c
parent5a181d43cbf84f8d4b60bac26b62722e8886bbea (diff)
downloadredis-88c1d9550d198fd7df426b19ea67e9c51c92a811.tar.gz
crc64.c modified for incremental computation.
Diffstat (limited to 'src/crc64.c')
-rw-r--r--src/crc64.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/crc64.c b/src/crc64.c
index f2ea8d4ae..ecdba90e0 100644
--- a/src/crc64.c
+++ b/src/crc64.c
@@ -170,8 +170,7 @@ static const uint64_t crc64_tab[256] = {
UINT64_C(0x536fa08fdfd90e51), UINT64_C(0x29b7d047efec8728),
};
-uint64_t crc64(const unsigned char *s, uint64_t l) {
- uint64_t crc = 0;
+uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l) {
uint64_t j;
for (j = 0; j < l; j++) {
@@ -186,7 +185,7 @@ uint64_t crc64(const unsigned char *s, uint64_t l) {
#include <stdio.h>
int main(void) {
printf("e9c6d914c4b8d9ca == %016llx\n",
- (unsigned long long) crc64((unsigned char*)"123456789",9));
+ (unsigned long long) crc64(0,(unsigned char*)"123456789",9));
return 0;
}
#endif