Skip to content

Commit e45e19d

Browse files
committed
update crc code for new api
1 parent 66d71e0 commit e45e19d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

crc.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ static const uint32_t crc_table[256] = {
7777
#define DO8(buf) DO4(buf); DO4(buf);
7878

7979
/* ========================================================================= */
80-
81-
void crc32 ( const void * key, int len, uint32_t seed, void * out )
80+
void crc32_with_state_test ( const void * key, int len, const void *state, void * out )
8281
{
8382
uint8_t * buf = (uint8_t*)key;
84-
uint32_t crc = seed ^ 0xffffffffL;
83+
uint32_t crc = *((uint32_t*)state) ^ 0xffffffffL;
8584

8685
while (len >= 8)
8786
{
@@ -98,3 +97,9 @@ void crc32 ( const void * key, int len, uint32_t seed, void * out )
9897

9998
*(uint32_t*)out = crc;
10099
}
100+
101+
void crc32_test ( const void * key, int len, uint32_t seed, void * out )
102+
{
103+
crc32_with_state_test(key,len,&seed,out);
104+
}
105+

crc32_hw.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ uint32_t crc32c_hw(const void *input, int len, uint32_t crc)
4242
return (crc ^ 0xFFFFFFFF);
4343
}
4444

45-
uint64_t crc64c_hw(const void *input, int len, uint32_t seed)
45+
uint64_t crc64c_hw(const void *input, int len, uint64_t seed)
4646
{
4747
const char* buf = (const char*)input;
48-
uint64_t crc = (uint64_t)seed;
48+
uint64_t crc = seed;
4949

5050
// Align the input to the word boundary
5151
for (; (len > 0) && ((size_t)buf & ALIGN_MASK); len--, buf++) {

0 commit comments

Comments
 (0)