demo3/demo/hamming.h

14 lines
328 B
C
Raw Normal View History

2024-11-30 02:15:30 +00:00
#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