summaryrefslogtreecommitdiff
path: root/crc32c.h
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2020-04-24 15:19:44 -0700
committerdormando <dormando@rydia.net>2020-04-30 17:34:10 -0700
commit97e8ebd82fc7ac142a30bd0740cd60bc37b8c8bc (patch)
tree42bb6eb9e9a1d48d2acfe6a35352f738c5099752 /crc32c.h
parentd9abf57787e9a0ae60161bbae6117056c49a5f11 (diff)
downloadmemcached-97e8ebd82fc7ac142a30bd0740cd60bc37b8c8bc.tar.gz
Pull in BE-compatible crc32c
with my qemu-mips test the CRC fails and the items are never fetched, this updated crc32c seems to fix that.
Diffstat (limited to 'crc32c.h')
-rw-r--r--crc32c.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/crc32c.h b/crc32c.h
index c09cb42..a403bd5 100644
--- a/crc32c.h
+++ b/crc32c.h
@@ -1,9 +1,15 @@
-#ifndef CRC32C_H
-#define CRC32C_H
+// crc32c.h -- header for crc32c.c
+// Copyright (C) 2015 Mark Adler
+// See crc32c.c for the license.
-typedef uint32_t (*crc_func)(uint32_t crc, const void *buf, size_t len);
-extern crc_func crc32c;
+#include <stdint.h>
-void crc32c_init(void);
+// Return the CRC-32C of buf[0..len-1] given the starting CRC crc. This can be
+// used to calculate the CRC of a sequence of bytes a chunk at a time, using
+// the previously returned crc in the next call. The first call must be with
+// crc == 0. crc32c() uses the Intel crc32 hardware instruction if available.
+uint32_t crc32c(uint32_t crc, void const *buf, size_t len);
-#endif /* CRC32C_H */
+// crc32c_sw() is the same, but does not use the hardware instruction, even if
+// available.
+uint32_t crc32c_sw(uint32_t crc, void const *buf, size_t len);