ucrc16.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
29 #include <stdint.h>
30 #include <stdlib.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
40 #define UCRC16_CCITT_POLY_BE (0x1021)
41 #define UCRC16_CCITT_POLY_LE (0x8408)
56 uint16_t ucrc16_calc_be(const uint8_t *buf, size_t len, uint16_t poly,
57  uint16_t seed);
58 
71 uint16_t ucrc16_calc_le(const uint8_t *buf, size_t len, uint16_t poly,
72  uint16_t seed);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
uint16_t ucrc16_calc_le(const uint8_t *buf, size_t len, uint16_t poly, uint16_t seed)
Calculate CRC16 (little-endian version)
uint16_t ucrc16_calc_be(const uint8_t *buf, size_t len, uint16_t poly, uint16_t seed)
Calculate CRC16 (big-endian version)