summaryrefslogtreecommitdiff
path: root/src/include/crc32c.h
blob: 49d68474d68bfce2e1fb3feb33333dae4c5af5b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef CEPH_CRC32C_H
#define CEPH_CRC32C_H

#include <inttypes.h>
#include <string.h>

typedef uint32_t (*ceph_crc32c_func_t)(uint32_t crc, unsigned char const *data, unsigned length);

/*
 * this is a static global with the chosen crc32c implementation for
 * the given architecture.
 */
extern ceph_crc32c_func_t ceph_crc32c_func;

extern ceph_crc32c_func_t ceph_choose_crc32(void);

/*
 * common entry point; use this!
 */
static inline uint32_t ceph_crc32c(uint32_t crc, unsigned char const *data, unsigned length)
{
	return ceph_crc32c_func(crc, data, length);
}

#endif