summaryrefslogtreecommitdiff
path: root/partx/crc32.h
blob: a4505b84257a29e5e91188a1bba1528f0e88a889 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * crc32.h
 */
#ifndef _CRC32_H
#define _CRC32_H

#include <inttypes.h>
#include <stdlib.h>

extern int init_crc32(void);
extern void cleanup_crc32(void);
extern uint32_t  crc32_le(uint32_t crc, unsigned char const *p, size_t len);
extern uint32_t  crc32_be(uint32_t crc, unsigned char const *p, size_t len);

#define crc32(seed, data, length)  crc32_le(seed, (unsigned char const *)data, length)
#define ether_crc_le(length, data) crc32_le(~0, data, length)
#define ether_crc(length, data)    crc32_be(~0, data, length)

#endif /* _CRC32_H */