JaiaBot
2.0.0
JaiaBot micro-AUV software
Loading...
Searching...
No Matches
fletcher16.h
Go to the documentation of this file.
1
#include <stdint.h>
2
#include <stdlib.h>
3
9
uint16_t
fletcher16
(
const
void
* input_str,
size_t
num_bytes)
10
{
11
uint16_t sum = 0;
12
uint8_t* sum1 = (uint8_t*)∑
13
uint8_t* sum2 = sum1 + 1;
14
15
const
uint8_t* buf = (uint8_t*)input_str;
16
17
for
(
int
i = 0; i < num_bytes; i++)
18
{
19
(*sum1) += buf[i];
20
(*sum2) += (*sum1);
21
}
22
23
return
sum;
24
}
fletcher16
uint16_t fletcher16(const void *input_str, size_t num_bytes)
Calculate the Fletcher-16 checksum of a block of data.
Definition
fletcher16.h:9
jaiabot
crc
fletcher16.h
Generated by
1.9.8