Loading...
Searching...
No Matches
crc8.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
20
21#include <stddef.h>
22#include <stdint.h>
23
24#include "compiler_hints.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
44ACCESS(read_only, 1, 2)
45uint8_t crc8(const uint8_t *data, size_t len, uint8_t poly, uint8_t seed);
46
61ACCESS(read_only, 1, 2)
62uint8_t crc8_lsb(const uint8_t *data, size_t len, uint8_t poly, uint8_t seed);
63
64#ifdef __cplusplus
65}
66#endif
67
Common macros and compiler attributes/pragmas configuration.
#define ACCESS(mode, ptr_idx, size_idx)
Emit an attribute (if supported by the compiler) that declares how a function will access its paramet...
uint8_t crc8_lsb(const uint8_t *data, size_t len, uint8_t poly, uint8_t seed)
Calculate a reflected CRC-8 (LSB first)
uint8_t crc8(const uint8_t *data, size_t len, uint8_t poly, uint8_t seed)
Calculate CRC-8 (MSB first)