14 lines
328 B
C
14 lines
328 B
C
|
#ifndef HAMMING_H
|
||
|
#define HAMMING_H
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
|
||
|
#define PARITY_BYTES 3 // 3字节校验位
|
||
|
|
||
|
// 函数声明
|
||
|
void calculateParity(const unsigned char *data, int size, unsigned char *parity);
|
||
|
int detectAndCorrect(unsigned char *data, int size, const unsigned char *parity);
|
||
|
|
||
|
#endif // HAMMING_H
|