forked from memcached/memcached
-
Notifications
You must be signed in to change notification settings - Fork 1
/
crc32c.h
23 lines (16 loc) · 770 Bytes
/
crc32c.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef CRC32C_H
#define CRC32C_H
// crc32c.h -- header for crc32c.c
// Copyright (C) 2015 Mark Adler
// See crc32c.c for the license.
#include <stdint.h>
// 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.
typedef uint32_t (*crc_func)(uint32_t crc, const void *buf, size_t len);
extern crc_func crc32c;
void crc32c_init(void);
// Expose a prototype for the crc32c software variant simply for testing purposes
uint32_t crc32c_sw(uint32_t crc, void const *buf, size_t len);
#endif /* CRC32C_H */