dcerpc-nt: add UNION_ALIGN_TO... helpers
[wireshark-sm.git] / wsutil / crc5.h
blob4f834d5360893d3fd59a2e75431479fbab5152d4
1 /** @file
2 * Declaration of CRC-5 routines and table
4 * 2019 Tomasz Mon <desowin@gmail.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __CRC5_H__
14 #define __CRC5_H__
16 #include <wireshark.h>
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
22 /** Compute the 5-bit CRC value of a input value matching the CRC-5
23 defined in USB 2.0 Specification. This function calculates the CRC
24 on low 11 bits of the input value. High bits are ignored.
25 @param input Source data for which the CRC-5 should be calculated.
26 @return the CRC5 checksum for input value */
27 WS_DLL_PUBLIC uint8_t crc5_usb_11bit_input(uint16_t input);
29 /** Compute the 5-bit CRC value of a input value matching the CRC-5
30 defined in USB 2.0 Specification. This function calculates the CRC
31 on low 19 bits of the input value. High bits are ignored.
32 @param input Source data for which the CRC-5 should be calculated.
33 @return the CRC5 checksum for input value */
34 WS_DLL_PUBLIC uint8_t crc5_usb_19bit_input(uint32_t input);
36 #ifdef __cplusplus
38 #endif /* __cplusplus */
40 #endif /* __CRC5_H__ */