Skip to content

Commit 91c2b8c

Browse files
authored
Added algorithms and Compiler Explorer link (#15)
* Added algorithms and Compiler Explorer link
1 parent 0845162 commit 91c2b8c

1 file changed

Lines changed: 67 additions & 1 deletion

File tree

README.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ for embedded systems where RAM and program memory are at a premium.
2323
If you are able to provide data to the CRC at compile time, the entire CRC is
2424
able to be computed at compile time.
2525

26+
2627
## Usage
2728

2829
Simply create an instance of the correct algorithm type, and continually
@@ -35,7 +36,7 @@ again.
3536

3637
#include "crc_cpp.h"
3738

38-
[[nodiscard]] auto compute_crc16ccit(std::vector<uint8_t> const &message)
39+
[[nodiscard]] constexpr auto compute_crc16ccit(std::vector<char> const &message)
3940
{
4041
crc_cpp::crc16_ccit crc;
4142

@@ -46,7 +47,15 @@ again.
4647
return crc.final();
4748
}
4849

50+
int main()
51+
{
52+
std::vector<char> const message{'1', '2', '3', '4', '5', '6', '7', '8', '9'};
53+
54+
return 0x29B1 == compute_crc16ccit(message);
55+
}
56+
4957
```
58+
[![Compiler Explorer](https://godbolt.org/favicon.ico) Try it on Compiler Explorer](https://godbolt.org/z/6Wc17zfze)
5059
5160
For each different CRC you use in the program, you will get a new table
5261
generated as they all will contain different values.
@@ -96,6 +105,63 @@ If the reverse parameter is `false`, the bits are rotated through the register
96105
MSB to LSB (rotate left). If it is `true` the reverse happens and bits are shifted through
97106
LSB to MSB (rotate right).
98107

108+
## Supported CRC Algorithms
109+
110+
### 8 Bit
111+
112+
- crc8
113+
- crc8_cdma2000
114+
- crc8_darc
115+
- crc8_dvbs2
116+
- crc8_ebu
117+
- crc8_icode
118+
- crc8_itu
119+
- crc8_maxim
120+
- crc8_rohc
121+
- crc8_wcdma
122+
123+
### 16 Bit
124+
125+
- crc16_ccit
126+
- crc16_arc
127+
- crc16_augccit
128+
- crc16_buypass
129+
- crc16_cdma2000
130+
- crc16_dds110
131+
- crc16_dectr
132+
- crc16_dectx
133+
- crc16_dnp
134+
- crc16_en13757
135+
- crc16_genibus
136+
- crc16_maxim
137+
- crc16_mcrf4xx
138+
- crc16_riello
139+
- crc16_t10dif
140+
- crc16_teledisk
141+
- crc16_tms37157
142+
- crc16_usb
143+
- crc16_a
144+
- crc16_kermit
145+
- crc16_modbus
146+
- crc16_x25
147+
- crc16_xmodem
148+
149+
### 32 Bit
150+
151+
- crc32
152+
- crc32_bzip2
153+
- crc32_c
154+
- crc32_d
155+
- crc32_mpeg2
156+
- crc32_posix
157+
- crc32_q
158+
- crc32_jamcrc
159+
- crc32_xfer
160+
161+
### 64 Bit
162+
163+
- crc64_ecma
164+
99165
## Limitations
100166

101167
Support is only provided for CRC algorithms with a register size of 8, 16, 32

0 commit comments

Comments
 (0)