CRC_t - is C++ template for calculation CRC any sizes(width) 1-64 bits.
License: BSD 3-Clause
Copyright (c) 2015, Koynov Stas - [email protected]
v4.0 (2023-05-27)
- New: Since version 4.0 required
C++14
- New: methods
get_crc
isconstexpr
- New: method
reflect
is fullconstexpr
- New: add
constexpr
for methodget_end_crc
- New: add
constexpr
ctor for tableImpl
(see note for bare-metall in README)
Since ver 4.0 methods get_crc
is constexpr
This allows you to calculate CRC for constexpr
variables in compile time.
This works in gcc 10. But it doesn't work in gcc 11. (reason for prohibiting use of static_cast
from const void*
in constexpr
functions)
But this feature should appear in C++26 see proposal: P2738
v3.0 (2023-05-23)
- New: Since version 3.0 required
C++11
- New: add
clean_up
for ASan - New: add
constexpr
variant ofreflect
method (only for constants) - Fix: deleted
crc_init
member (methodget_crc_init()
is fullconstexpr
- use std
static_assert
- replace
NULL
->nullptr
v2.1 (2023-05-12)
- New: use cmake for build tests
- Fix: use
__INCLUDE_LEVEL__
inSTATIC_ASSERT
for fix ODR in headers
- replaced
std::string
toconst char*
in Proxy - use
stest_printf
for embedded (was bestd::cerr
) - deleted
get_cnt_impl()
, add constCNT_IMPL
- deleted
sstream
, useTEST_ASSERTF
withprintf
- add
static
prefix for some methods
- add to CRC list
CRC-64/MS
- add to CRC list
CRC-64/REDIS
- add to CRC list
CRC-32/MEF
- add to CRC list
CRC-16/M17
- add to CRC list
CRC-8/HITAG
v2.0 (2020-05-01)
-
New: Started using pattern CRTP this allows the use of static polymorphism. And this allows you to extract each algorithm to a separate class!
-
New: extracted base class
CRCBase_t
fromCRC_t
-
New: add template parameter
Impl
(Implementation of algorithm) -
New: add implementation of algorithm CRCImplTable4 - table for half byte (16 elements)
-
New: add implementation of algorithm CRCImplBits - loop for 8 bits in byte (no table)
-
The current version are supported:
- CRCImplBits - loop for 8 bits in byte (no table) - new
- CRCImplTable4 - table for half byte (16 elements) - new
- CRCImplTable8 - std table for byte (256 elements)
- Ref: join
init_xxx_crc_table
to one method (small code) - Ref: moved
get_raw_normal
/reflect_crc
fromImplBits
to Base class
- add to tests CRCImplBits strategy
- add to tests CRCImplTable4 strategy
- add
test_crc_impl_1byte
- add
test_crc_impl_data_xyz_256
- add
test_crc_impl_data_xxx_256
- add
test_crc_for_cunks2
for test wrapperget_raw_crc
- add
test_crc_speed
- benchmark for calc speed for 1GB data
v1.2 (2018-01-11)
- deleted
name
field - user self can add it (if need)
- BugFix: bad error message if test is fail (
ss
was be on stack)
reflect
method- use
std::ifstream
for calculate crc for file - delete prefix
register
- old style - moved var
shift
toget_raw_crc()
method - moved calculate
crc_mask
andtop_bit
to methods - divided the
init_crc_table
function into two functionsnormal\reflected
- rename
get_final_crc
->get_end_crc
- add to CRC list
CRC-8/BLUETOOTH
- add to CRC list
CRC-8/NRSC-5
- add to CRC list
CRC-16/NRSC-5
- add to CRC list
CRC-17/CAN-FD
- add to CRC list
CRC-21/CAN-FD
- add to CRC list
CRC-24/OS-9
v1.1 (2017-05-03)
- add method
get_check
- crc for ASCII string '123456789'
- Replacement
(const char *)
to(const void *)
- for ease use methods:get_crc
andget_raw_crc
- Add
CRC_STATIC_ASSERT
forBits
param of template
- add to CRC list
CRC-64/GO-ISO
- add to CRC list
CRC-32/AUTOSAR
- add to CRC list
CRC-30/CDMA
- add to CRC list
CRC-24/LTE-B
- add to CRC list
CRC-24/LTE-A
- add to CRC list
CRC-24/INTERLAKEN
- add to CRC list
CRC-24/BLE
- add to CRC list
CRC-16/PROFIBUS
- add to CRC list
CRC-16/OPENSAFETY-B
- add to CRC list
CRC-16/OPENSAFETY-A
- add to CRC list
CRC-16/LJ1200
- add to CRC list
CRC-16/GSM
- add to CRC list
CRC-16/CMS
- add to CRC list
CRC-14/GSM
- add to CRC list
CRC-12/GSM
- add to CRC list
CRC-11/UMTS
- add to CRC list
CRC-10/GSM
- add to CRC list
CRC-8/SAE-J1850
- add to CRC list
CRC-8/OPENSAFETY
- add to CRC list
CRC-8/LTE
- add to CRC list
CRC-8/GSM-B
- add to CRC list
CRC-8/GSM-A
- add to CRC list
CRC-8/AUTOSAR
- add to CRC list
CRC-7/UMTS
- add to CRC list
CRC-6/GSM
- add to CRC list
CRC-4/INTERLAKEN
- add to CRC list
CRC-3/GSM