Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
bb99f425
Commit
bb99f425
authored
Apr 09, 2012
by
antirez
Browse files
crc64.c modified for incremental computation.
parent
9ba4d5a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/crc64.c
View file @
bb99f425
...
@@ -170,8 +170,7 @@ static const uint64_t crc64_tab[256] = {
...
@@ -170,8 +170,7 @@ static const uint64_t crc64_tab[256] = {
UINT64_C
(
0x536fa08fdfd90e51
),
UINT64_C
(
0x29b7d047efec8728
),
UINT64_C
(
0x536fa08fdfd90e51
),
UINT64_C
(
0x29b7d047efec8728
),
};
};
uint64_t
crc64
(
const
unsigned
char
*
s
,
uint64_t
l
)
{
uint64_t
crc64
(
uint64_t
crc
,
const
unsigned
char
*
s
,
uint64_t
l
)
{
uint64_t
crc
=
0
;
uint64_t
j
;
uint64_t
j
;
for
(
j
=
0
;
j
<
l
;
j
++
)
{
for
(
j
=
0
;
j
<
l
;
j
++
)
{
...
@@ -186,7 +185,7 @@ uint64_t crc64(const unsigned char *s, uint64_t l) {
...
@@ -186,7 +185,7 @@ uint64_t crc64(const unsigned char *s, uint64_t l) {
#include <stdio.h>
#include <stdio.h>
int
main
(
void
)
{
int
main
(
void
)
{
printf
(
"e9c6d914c4b8d9ca == %016llx
\n
"
,
printf
(
"e9c6d914c4b8d9ca == %016llx
\n
"
,
(
unsigned
long
long
)
crc64
((
unsigned
char
*
)
"123456789"
,
9
));
(
unsigned
long
long
)
crc64
(
0
,
(
unsigned
char
*
)
"123456789"
,
9
));
return
0
;
return
0
;
}
}
#endif
#endif
src/redis.h
View file @
bb99f425
...
@@ -693,7 +693,7 @@ extern dictType hashDictType;
...
@@ -693,7 +693,7 @@ extern dictType hashDictType;
long
long
ustime
(
void
);
long
long
ustime
(
void
);
long
long
mstime
(
void
);
long
long
mstime
(
void
);
void
getRandomHexChars
(
char
*
p
,
unsigned
int
len
);
void
getRandomHexChars
(
char
*
p
,
unsigned
int
len
);
uint64_t
crc64
(
const
unsigned
char
*
s
,
uint64_t
l
);
uint64_t
crc64
(
uint64_t
crc
,
const
unsigned
char
*
s
,
uint64_t
l
);
void
exitFromChild
(
int
retcode
);
void
exitFromChild
(
int
retcode
);
/* networking.c -- Networking and Client related operations */
/* networking.c -- Networking and Client related operations */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment