2007-11-14 17:58:38 +00:00
|
|
|
#ifndef TOKU_CRC_H
|
|
|
|
#define TOKU_CRC_H
|
2007-11-29 14:18:54 +00:00
|
|
|
|
2008-01-24 15:10:32 +00:00
|
|
|
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
|
2007-11-29 14:18:54 +00:00
|
|
|
|
2007-11-14 17:58:38 +00:00
|
|
|
#include <zlib.h>
|
|
|
|
|
|
|
|
// zlib crc32 has a bug: If len==0 then it should return oldcrc32, but crc32 returns 0.
|
|
|
|
static inline u_int32_t toku_crc32 (u_int32_t oldcrc32, const void *data, u_int32_t len) {
|
|
|
|
if (len==0) return oldcrc32;
|
2008-02-01 18:47:40 +00:00
|
|
|
else return crc32((unsigned long)oldcrc32, data, len);
|
2007-11-14 17:58:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const u_int32_t toku_null_crc = 0;
|
|
|
|
|
|
|
|
// Don't use crc32, use toku_crc32 to avoid that bug.
|
|
|
|
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)) __attribute__((deprecated));
|
|
|
|
#endif
|