OpenRTM-aist  1.2.1
crc.h
Go to the documentation of this file.
1 // -*- C++ -*-
18 #ifndef COIL_CRC_H
19 #define COIL_CRC_H
20 
21 #include <sys/types.h>
22 
23 namespace coil
24 {
25  /*
26  * @if jp
27  *
28  * @brief CRC-16 計算関数
29  *
30  * CRC種類: CRC-CCITT
31  * CRC多項式: x^16 + x^12 + x^5 + 1 (0x1021)
32  * 初期値: 0xFFFF
33  * 出力XOR: 0x0000
34  * 入力ビット反転: なし
35  * 出力ビット反転: なし
36  * ビットシフト: 左
37  *
38  * @param str データストリーム
39  * @param len データ長
40  *
41  * @return 計算結果
42  *
43  * @else
44  *
45  * @brief CRC-16 calculation function
46  *
47  * CRC type: CRC-CCITT
48  * CRC generator polynomial: x^16 + x^12 + x^5 + 1 (0x1021)
49  * Initial value: 0xFFFF
50  * Output XOR: 0x0000
51  * Input bit inversion: None
52  * Output bit inversion: None
53  * Bit shift: left
54  *
55  * @param str Data stream
56  * @param len Data length
57  *
58  * @return Result calculation
59  *
60  * @endif
61  */
62  unsigned short crc16(const char* str, size_t len);
63 
103  unsigned long crc32(const char* str, size_t len);
104 }; //namespace coil
105 
106 #endif // COIL_CRC_H
unsigned short crc16(const char *str, size_t len)
unsigned long crc32(const char *str, size_t len)
CRC-32 calculation function.
Common Object Interface Layer.
Definition: Affinity.h:28