From 45366d2a78c07a9aa3420b6d5da9d765c327a3a7 Mon Sep 17 00:00:00 2001 From: Zach O'Brien Date: Thu, 16 Jan 2025 09:55:24 -0700 Subject: [PATCH 1/3] Making crc constexpr for c++14. Allows compile time CRC computation. --- include/etl/frame_check_sequence.h | 16 +- include/etl/private/crc_implementation.h | 602 ++++++++++++----------- test/test_crc16.cpp | 22 + test/test_crc16_a.cpp | 33 ++ test/test_crc16_arc.cpp | 33 ++ test/test_crc16_aug_ccitt.cpp | 33 ++ test/test_crc16_buypass.cpp | 33 ++ test/test_crc16_ccitt.cpp | 33 ++ test/test_crc16_cdma2000.cpp | 33 ++ test/test_crc16_dds110.cpp | 33 ++ test/test_crc16_dectr.cpp | 33 ++ test/test_crc16_dectx.cpp | 33 ++ test/test_crc16_dnp.cpp | 33 ++ test/test_crc16_en13757.cpp | 33 ++ test/test_crc16_genibus.cpp | 33 ++ test/test_crc16_kermit.cpp | 33 ++ test/test_crc16_m17.cpp | 33 ++ test/test_crc16_maxim.cpp | 33 ++ test/test_crc16_mcrf4xx.cpp | 33 ++ test/test_crc16_modbus.cpp | 33 ++ test/test_crc16_profibus.cpp | 33 ++ test/test_crc16_riello.cpp | 33 ++ test/test_crc16_t10dif.cpp | 33 ++ test/test_crc16_teledisk.cpp | 33 ++ test/test_crc16_tms37157.cpp | 33 ++ test/test_crc16_usb.cpp | 33 ++ test/test_crc16_x25.cpp | 33 ++ test/test_crc16_xmodem.cpp | 33 ++ test/test_crc32.cpp | 22 + test/test_crc32_bzip2.cpp | 33 ++ test/test_crc32_c.cpp | 33 ++ test/test_crc32_d.cpp | 33 ++ test/test_crc32_jamcrc.cpp | 33 ++ test/test_crc32_mpeg2.cpp | 33 ++ test/test_crc32_posix.cpp | 33 ++ test/test_crc32_q.cpp | 33 ++ test/test_crc32_xfer.cpp | 33 ++ test/test_crc64_ecma.cpp | 33 ++ test/test_crc8_ccitt.cpp | 33 ++ test/test_crc8_cdma2000.cpp | 33 ++ test/test_crc8_darc.cpp | 33 ++ test/test_crc8_dvbs2.cpp | 33 ++ test/test_crc8_ebu.cpp | 33 ++ test/test_crc8_icode.cpp | 33 ++ test/test_crc8_itu.cpp | 33 ++ test/test_crc8_j1850.cpp | 33 ++ test/test_crc8_j1850_zero.cpp | 33 ++ test/test_crc8_maxim.cpp | 33 ++ test/test_crc8_rohc.cpp | 33 ++ test/test_crc8_wcdma.cpp | 33 ++ 50 files changed, 1874 insertions(+), 306 deletions(-) diff --git a/include/etl/frame_check_sequence.h b/include/etl/frame_check_sequence.h index ec67e1bac..d959472dc 100644 --- a/include/etl/frame_check_sequence.h +++ b/include/etl/frame_check_sequence.h @@ -107,7 +107,7 @@ namespace etl //************************************************************************* /// Default constructor. //************************************************************************* - frame_check_sequence() + ETL_CONSTEXPR14 frame_check_sequence() : frame_check{} { reset(); } @@ -118,7 +118,7 @@ namespace etl /// \param end End of the range. //************************************************************************* template - frame_check_sequence(TIterator begin, const TIterator end) + ETL_CONSTEXPR14 frame_check_sequence(TIterator begin, const TIterator end) : frame_check{} { ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Type not supported"); @@ -129,7 +129,7 @@ namespace etl //************************************************************************* /// Resets the FCS to the initial state. //************************************************************************* - void reset() + ETL_CONSTEXPR14 void reset() { frame_check = policy.initial(); } @@ -140,7 +140,7 @@ namespace etl /// \param end //************************************************************************* template - void add(TIterator begin, const TIterator end) + ETL_CONSTEXPR14 void add(TIterator begin, const TIterator end) { ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Type not supported"); @@ -154,7 +154,7 @@ namespace etl //************************************************************************* /// \param value The uint8_t to add to the FCS. //************************************************************************* - void add(uint8_t value_) + ETL_CONSTEXPR14 void add(uint8_t value_) { frame_check = policy.add(frame_check, value_); } @@ -162,7 +162,7 @@ namespace etl //************************************************************************* /// Gets the FCS value. //************************************************************************* - value_type value() const + ETL_CONSTEXPR14 value_type value() const { return policy.final(frame_check); } @@ -170,7 +170,7 @@ namespace etl //************************************************************************* /// Conversion operator to value_type. //************************************************************************* - operator value_type () const + ETL_CONSTEXPR14 operator value_type () const { return policy.final(frame_check); } @@ -178,7 +178,7 @@ namespace etl //************************************************************************* /// Gets an add_insert_iterator for input. //************************************************************************* - add_insert_iterator input() + ETL_CONSTEXPR14 add_insert_iterator input() { return add_insert_iterator(*this); } diff --git a/include/etl/private/crc_implementation.h b/include/etl/private/crc_implementation.h index d94f0f181..557e37d9b 100644 --- a/include/etl/private/crc_implementation.h +++ b/include/etl/private/crc_implementation.h @@ -163,7 +163,7 @@ namespace etl // Accumulator_Bits > Chunk_Bits // Not Reflected template - static + static ETL_CONSTEXPR14 typename etl::enable_if<(Accumulator_Bits > Chunk_Bits) && !Reflect, TAccumulator>::type crc_update_chunk(TAccumulator crc, uint8_t value, const TAccumulator table[]) { @@ -181,7 +181,7 @@ namespace etl // Accumulator_Bits > Chunk_Bits // Reflected template - static + static ETL_CONSTEXPR14 typename etl::enable_if<(Accumulator_Bits > Chunk_Bits) && Reflect, TAccumulator>::type crc_update_chunk(TAccumulator crc, uint8_t value, const TAccumulator table[]) { @@ -199,7 +199,7 @@ namespace etl // Accumulator_Bits == Chunk_Bits // Not Reflected template - static + static ETL_CONSTEXPR14 typename etl::enable_if<(Accumulator_Bits == Chunk_Bits) && !Reflect, TAccumulator>::type crc_update_chunk(TAccumulator crc, uint8_t value, const TAccumulator table[]) { @@ -216,7 +216,7 @@ namespace etl // Accumulator_Bits == Chunk_Bits // Reflected template - static + static ETL_CONSTEXPR14 typename etl::enable_if<(Accumulator_Bits == Chunk_Bits) && Reflect, TAccumulator>::type crc_update_chunk(TAccumulator crc, uint8_t value, const TAccumulator table[]) { @@ -241,16 +241,16 @@ namespace etl struct crc_table { //************************************************************************* - TAccumulator add(TAccumulator crc, uint8_t value) const + static ETL_CONSTANT TAccumulator table[4U] = { - static ETL_CONSTANT TAccumulator table[4U] = - { - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value - }; + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value + }; + ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const + { if ETL_IF_CONSTEXPR(Reflect) { crc = crc_update_chunk(crc, value, table); @@ -269,6 +269,8 @@ namespace etl return crc; } }; + template + ETL_CONSTANT TAccumulator crc_table::table[4U]; //********************************* // Table size of 16. @@ -276,28 +278,28 @@ namespace etl struct crc_table { //************************************************************************* - TAccumulator add(TAccumulator crc, uint8_t value) const + static ETL_CONSTANT TAccumulator table[16U] = + { + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value + }; + + ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const { - static ETL_CONSTANT TAccumulator table[16U] = - { - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value - }; - if ETL_IF_CONSTEXPR(Reflect) { crc = crc_update_chunk(crc, value, table); @@ -312,6 +314,8 @@ namespace etl return crc; } }; + template + ETL_CONSTANT TAccumulator crc_table::table[16U]; //********************************* // Table size of 256. @@ -319,273 +323,275 @@ namespace etl struct crc_table { //************************************************************************* - TAccumulator add(TAccumulator crc, uint8_t value) const + static ETL_CONSTANT TAccumulator table[256U] = + { + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value + }; + ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const { - static ETL_CONSTANT TAccumulator table[256U] = - { - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value - }; crc = crc_update_chunk(crc, value, table); return crc; } }; + template + ETL_CONSTANT TAccumulator crc_table::table[256U]; //***************************************************************************** // CRC Policies. @@ -615,7 +621,7 @@ namespace etl } //************************************************************************* - accumulator_type final(accumulator_type crc) const + ETL_CONSTEXPR accumulator_type final(accumulator_type crc) const { return crc ^ TCrcParameters::Xor_Out; } @@ -643,7 +649,7 @@ namespace etl } //************************************************************************* - accumulator_type final(accumulator_type crc) const + ETL_CONSTEXPR accumulator_type final(accumulator_type crc) const { return crc ^ TCrcParameters::Xor_Out; } @@ -671,7 +677,7 @@ namespace etl } //************************************************************************* - accumulator_type final(accumulator_type crc) const + ETL_CONSTEXPR accumulator_type final(accumulator_type crc) const { return crc ^ TCrcParameters::Xor_Out; } @@ -691,7 +697,7 @@ namespace etl //************************************************************************* /// Default constructor. //************************************************************************* - crc_type() + ETL_CONSTEXPR14 crc_type() { this->reset(); } @@ -702,7 +708,7 @@ namespace etl /// \param end End of the range. //************************************************************************* template - crc_type(TIterator begin, const TIterator end) + ETL_CONSTEXPR14 crc_type(TIterator begin, const TIterator end) { this->reset(); this->add(begin, end); diff --git a/test/test_crc16.cpp b/test/test_crc16.cpp index b1f2328d5..d70b90c4a 100644 --- a/test/test_crc16.cpp +++ b/test/test_crc16.cpp @@ -127,6 +127,17 @@ namespace CHECK_EQUAL(0xBB3DU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_t16(data, data + 9); + + CHECK_EQUAL(0xBB3DU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_16_add_values) { @@ -199,6 +210,17 @@ namespace CHECK_EQUAL(0xBB3DU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_t4(data, data + 9); + + CHECK_EQUAL(0xBB3DU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_4_add_values) { diff --git a/test/test_crc16_a.cpp b/test/test_crc16_a.cpp index fe922a2e8..2367fefbf 100644 --- a/test/test_crc16_a.cpp +++ b/test/test_crc16_a.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xBF05U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_a_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_a(data, data + 9); + + CHECK_EQUAL(0xBF05U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_a_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xBF05U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_a_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_a_t16(data, data + 9); + + CHECK_EQUAL(0xBF05U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_a_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xBF05U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_a_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_a_t4(data, data + 9); + + CHECK_EQUAL(0xBF05U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_a_4_add_values) { diff --git a/test/test_crc16_arc.cpp b/test/test_crc16_arc.cpp index 3e7768f79..eaf17dc18 100644 --- a/test/test_crc16_arc.cpp +++ b/test/test_crc16_arc.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xBB3DU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_arc_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_arc(data, data + 9); + + CHECK_EQUAL(0xBB3DU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_arc_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xBB3DU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_arc_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_arc_t16(data, data + 9); + + CHECK_EQUAL(0xBB3DU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_arc_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xBB3DU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_arc_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_arc_t4(data, data + 9); + + CHECK_EQUAL(0xBB3DU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_arc_4_add_values) { diff --git a/test/test_crc16_aug_ccitt.cpp b/test/test_crc16_aug_ccitt.cpp index 8f5a16127..a89bf787c 100644 --- a/test/test_crc16_aug_ccitt.cpp +++ b/test/test_crc16_aug_ccitt.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xE5CCU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_aug_ccitt_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_aug_ccitt(data, data + 9); + + CHECK_EQUAL(0xE5CCU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_aug_ccitt_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xE5CCU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_aug_ccitt_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_aug_ccitt_t16(data, data + 9); + + CHECK_EQUAL(0xE5CCU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_aug_ccitt_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xE5CCU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_aug_ccitt_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_aug_ccitt_t4(data, data + 9); + + CHECK_EQUAL(0xE5CCU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_aug_ccitt_4_add_values) { diff --git a/test/test_crc16_buypass.cpp b/test/test_crc16_buypass.cpp index 9aa813648..9104ed2f1 100644 --- a/test/test_crc16_buypass.cpp +++ b/test/test_crc16_buypass.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xFEE8U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_buypass_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_buypass(data, data + 9); + + CHECK_EQUAL(0xFEE8U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_buypass_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xFEE8U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_buypass_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_buypass_t16(data, data + 9); + + CHECK_EQUAL(0xFEE8U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_buypass_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xFEE8U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_buypass_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_buypass_t4(data, data + 9); + + CHECK_EQUAL(0xFEE8U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_buypass_4_add_values) { diff --git a/test/test_crc16_ccitt.cpp b/test/test_crc16_ccitt.cpp index e81dce28f..783992529 100644 --- a/test/test_crc16_ccitt.cpp +++ b/test/test_crc16_ccitt.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x29B1U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_ccitt_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_ccitt(data, data + 9); + + CHECK_EQUAL(0x29B1U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_ccitt_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x29B1U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_ccitt_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_ccitt_t16(data, data + 9); + + CHECK_EQUAL(0x29B1U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_ccitt_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x29B1U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_ccitt_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_ccitt_t4(data, data + 9); + + CHECK_EQUAL(0x29B1U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_ccitt_4_add_values) { diff --git a/test/test_crc16_cdma2000.cpp b/test/test_crc16_cdma2000.cpp index 885a237a6..18324f809 100644 --- a/test/test_crc16_cdma2000.cpp +++ b/test/test_crc16_cdma2000.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x4C06U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_cdma2000_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_cdma2000(data, data + 9); + + CHECK_EQUAL(0x4C06U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_cdma2000_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x4C06U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_cdma2000_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_cdma2000_t16(data, data + 9); + + CHECK_EQUAL(0x4C06U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_cdma2000_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x4C06U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_cdma2000_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_cdma2000_t4(data, data + 9); + + CHECK_EQUAL(0x4C06U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_cdma2000_4_add_values) { diff --git a/test/test_crc16_dds110.cpp b/test/test_crc16_dds110.cpp index 8bed8046f..3eaee997e 100644 --- a/test/test_crc16_dds110.cpp +++ b/test/test_crc16_dds110.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x9ECFU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dds110_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dds110(data, data + 9); + + CHECK_EQUAL(0x9ECFU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dds110_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x9ECFU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dds110_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dds110_t16(data, data + 9); + + CHECK_EQUAL(0x9ECFU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dds110_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x9ECFU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dds110_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dds110_t4(data, data + 9); + + CHECK_EQUAL(0x9ECFU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dds110_4_add_values) { diff --git a/test/test_crc16_dectr.cpp b/test/test_crc16_dectr.cpp index d99d9d613..1f5f1454b 100644 --- a/test/test_crc16_dectr.cpp +++ b/test/test_crc16_dectr.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x007EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dect_r_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dectr(data, data + 9); + + CHECK_EQUAL(0x007EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dect_r_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x007EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dect_r_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dect_r_t16(data, data + 9); + + CHECK_EQUAL(0x007EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dect_r_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x007EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dect_r_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dect_r_t4(data, data + 9); + + CHECK_EQUAL(0x007EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dect_r_4_add_values) { diff --git a/test/test_crc16_dectx.cpp b/test/test_crc16_dectx.cpp index bf7db4235..e5510a392 100644 --- a/test/test_crc16_dectx.cpp +++ b/test/test_crc16_dectx.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x007FU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dect_x_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dectx(data, data + 9); + + CHECK_EQUAL(0x007FU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dect_x_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x007FU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dect_x_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dect_x_t16(data, data + 9); + + CHECK_EQUAL(0x007FU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dect_x_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x007FU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dect_x_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dect_x_t4(data, data + 9); + + CHECK_EQUAL(0x007FU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dect_x_4_add_values) { diff --git a/test/test_crc16_dnp.cpp b/test/test_crc16_dnp.cpp index 82069d6ad..e8245cc97 100644 --- a/test/test_crc16_dnp.cpp +++ b/test/test_crc16_dnp.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xEA82U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dnp_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dnp(data, data + 9); + + CHECK_EQUAL(0xEA82U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dnp_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xEA82U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dnp_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dnp_t16(data, data + 9); + + CHECK_EQUAL(0xEA82U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dnp_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xEA82U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_dnp_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_dnp_t4(data, data + 9); + + CHECK_EQUAL(0xEA82U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_dnp_4_add_values) { diff --git a/test/test_crc16_en13757.cpp b/test/test_crc16_en13757.cpp index f63df0d1b..c4bf990b0 100644 --- a/test/test_crc16_en13757.cpp +++ b/test/test_crc16_en13757.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xC2B7U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_en13757_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_en13757(data, data + 9); + + CHECK_EQUAL(0xC2B7U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_en13757_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xC2B7U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_en13757_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_en13757_t16(data, data + 9); + + CHECK_EQUAL(0xC2B7U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_en13757_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xC2B7U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_en13757_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_en13757_t4(data, data + 9); + + CHECK_EQUAL(0xC2B7U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_en13757_4_add_values) { diff --git a/test/test_crc16_genibus.cpp b/test/test_crc16_genibus.cpp index 3ab8f68b9..fc8380dd0 100644 --- a/test/test_crc16_genibus.cpp +++ b/test/test_crc16_genibus.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xD64EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_genibus_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_genibus(data, data + 9); + + CHECK_EQUAL(0xD64EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_genibus_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xD64EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_genibus_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_genibus_t16(data, data + 9); + + CHECK_EQUAL(0xD64EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_genibus_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xD64EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_genibus_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_genibus_t4(data, data + 9); + + CHECK_EQUAL(0xD64EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_genibus_4_add_values) { diff --git a/test/test_crc16_kermit.cpp b/test/test_crc16_kermit.cpp index 627691149..27dd89c8e 100644 --- a/test/test_crc16_kermit.cpp +++ b/test/test_crc16_kermit.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x2189U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_kermit_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_kermit(data, data + 9); + + CHECK_EQUAL(0x2189U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_kermit_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x2189U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_kermit_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_kermit_t16(data, data + 9); + + CHECK_EQUAL(0x2189U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_kermit_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x2189U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_kermit_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_kermit_t4(data, data + 9); + + CHECK_EQUAL(0x2189U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_kermit_4_add_values) { diff --git a/test/test_crc16_m17.cpp b/test/test_crc16_m17.cpp index b28d624b5..2af0155f3 100644 --- a/test/test_crc16_m17.cpp +++ b/test/test_crc16_m17.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x772BU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_m17_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_m17(data, data + 9); + + CHECK_EQUAL(0x772BU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_m17_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x772BU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_m17_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_m17_t16(data, data + 9); + + CHECK_EQUAL(0x772BU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_m17_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x772BU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_m17_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_m17_t4(data, data + 9); + + CHECK_EQUAL(0x772BU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_m17_4_add_values) { diff --git a/test/test_crc16_maxim.cpp b/test/test_crc16_maxim.cpp index a2a92e405..df7e527c6 100644 --- a/test/test_crc16_maxim.cpp +++ b/test/test_crc16_maxim.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x44C2U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_maxim_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_maxim(data, data + 9); + + CHECK_EQUAL(0x44C2U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_maxim_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x44C2U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_maxim_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_maxim_t16(data, data + 9); + + CHECK_EQUAL(0x44C2U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_maxim_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x44C2U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_maxim_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_maxim_t4(data, data + 9); + + CHECK_EQUAL(0x44C2U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_maxim_4_add_values) { diff --git a/test/test_crc16_mcrf4xx.cpp b/test/test_crc16_mcrf4xx.cpp index eed2f024e..d645282e9 100644 --- a/test/test_crc16_mcrf4xx.cpp +++ b/test/test_crc16_mcrf4xx.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x6F91U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_mcrf4xx_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_mcrf4xx(data, data + 9); + + CHECK_EQUAL(0x6F91U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_mcrf4xx_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x6F91U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_mcrf4xx_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_mcrf4xx_t16(data, data + 9); + + CHECK_EQUAL(0x6F91U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_mcrf4xx_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x6F91U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_mcrf4xx_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_mcrf4xx_t4(data, data + 9); + + CHECK_EQUAL(0x6F91U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_mcrf4xx_4_add_values) { diff --git a/test/test_crc16_modbus.cpp b/test/test_crc16_modbus.cpp index 6f5779f92..430773bb6 100644 --- a/test/test_crc16_modbus.cpp +++ b/test/test_crc16_modbus.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x4B37U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_modbus_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_modbus(data, data + 9); + + CHECK_EQUAL(0x4B37U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_modbus_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x4B37U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_modbus_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_modbus_t16(data, data + 9); + + CHECK_EQUAL(0x4B37U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_modbus_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x4B37U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_modbus_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_modbus_t4(data, data + 9); + + CHECK_EQUAL(0x4B37U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_modbus_4_add_values) { diff --git a/test/test_crc16_profibus.cpp b/test/test_crc16_profibus.cpp index 351395343..dce88f225 100644 --- a/test/test_crc16_profibus.cpp +++ b/test/test_crc16_profibus.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xA819U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_profibus_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_profibus(data, data + 9); + + CHECK_EQUAL(0xA819U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_profibus_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xA819U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_profibus_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_profibus_t16(data, data + 9); + + CHECK_EQUAL(0xA819U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_profibus_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xA819U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_profibus_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_profibus_t4(data, data + 9); + + CHECK_EQUAL(0xA819U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_profibus_4_add_values) { diff --git a/test/test_crc16_riello.cpp b/test/test_crc16_riello.cpp index d54d0fab3..b4aa86d3b 100644 --- a/test/test_crc16_riello.cpp +++ b/test/test_crc16_riello.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x63D0U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_riello_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_riello(data, data + 9); + + CHECK_EQUAL(0x63D0U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_riello_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x63D0U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_riello_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_riello_t16(data, data + 9); + + CHECK_EQUAL(0x63D0U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_riello_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x63D0U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_riello_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_riello_t4(data, data + 9); + + CHECK_EQUAL(0x63D0U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_riello_4_add_values) { diff --git a/test/test_crc16_t10dif.cpp b/test/test_crc16_t10dif.cpp index 78e3107da..21568718f 100644 --- a/test/test_crc16_t10dif.cpp +++ b/test/test_crc16_t10dif.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xD0DBU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_t10dif_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_t10dif(data, data + 9); + + CHECK_EQUAL(0xD0DBU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_t10dif_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xD0DBU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_t10dif_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_t10dif_t16(data, data + 9); + + CHECK_EQUAL(0xD0DBU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_t10dif_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xD0DBU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_t10dif_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_t10dif_t4(data, data + 9); + + CHECK_EQUAL(0xD0DBU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_t10dif_4_add_values) { diff --git a/test/test_crc16_teledisk.cpp b/test/test_crc16_teledisk.cpp index 063c725f4..6ffa7a3d3 100644 --- a/test/test_crc16_teledisk.cpp +++ b/test/test_crc16_teledisk.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x0FB3U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_teledisk_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_teledisk(data, data + 9); + + CHECK_EQUAL(0x0FB3U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_teledisk_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x0FB3U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_teledisk_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_teledisk_t16(data, data + 9); + + CHECK_EQUAL(0x0FB3U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_teledisk_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x0FB3U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_teledisk_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_teledisk_t4(data, data + 9); + + CHECK_EQUAL(0x0FB3U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_teledisk_4_add_values) { diff --git a/test/test_crc16_tms37157.cpp b/test/test_crc16_tms37157.cpp index 1fc0d3e6b..4304d19c2 100644 --- a/test/test_crc16_tms37157.cpp +++ b/test/test_crc16_tms37157.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x26B1U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_tms37157_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_tms37157(data, data + 9); + + CHECK_EQUAL(0x26B1U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_tms37157_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x26B1U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_tms37157_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_tms37157_t16(data, data + 9); + + CHECK_EQUAL(0x26B1U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_tms37157_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x26B1U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_tms37157_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_tms37157_t4(data, data + 9); + + CHECK_EQUAL(0x26B1U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_tms37157_4_add_values) { diff --git a/test/test_crc16_usb.cpp b/test/test_crc16_usb.cpp index 3f3d23b65..5479992e0 100644 --- a/test/test_crc16_usb.cpp +++ b/test/test_crc16_usb.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xB4C8U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_usb_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_usb(data, data + 9); + + CHECK_EQUAL(0xB4C8U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_usb_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xB4C8U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_usb_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_usb_t16(data, data + 9); + + CHECK_EQUAL(0xB4C8U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_usb_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xB4C8U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_usb_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_usb_t4(data, data + 9); + + CHECK_EQUAL(0xB4C8U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_usb_4_add_values) { diff --git a/test/test_crc16_x25.cpp b/test/test_crc16_x25.cpp index 2906214a6..77c7f7fb4 100644 --- a/test/test_crc16_x25.cpp +++ b/test/test_crc16_x25.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x906EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_x25_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_x25(data, data + 9); + + CHECK_EQUAL(0x906EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_x25_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x906EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_x25_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_x25_t16(data, data + 9); + + CHECK_EQUAL(0x906EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_x25_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x906EU, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_x25_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_x25_t4(data, data + 9); + + CHECK_EQUAL(0x906EU, crc); + } +#endif + //************************************************************************* TEST(test_crc16_x25_4_add_values) { diff --git a/test/test_crc16_xmodem.cpp b/test/test_crc16_xmodem.cpp index e303ee24f..e116126d1 100644 --- a/test/test_crc16_xmodem.cpp +++ b/test/test_crc16_xmodem.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x31C3U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_xmodem_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_xmodem(data, data + 9); + + CHECK_EQUAL(0x31C3U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_xmodem_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x31C3U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_xmodem_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_xmodem_t16(data, data + 9); + + CHECK_EQUAL(0x31C3U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_xmodem_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x31C3U, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc16_xmodem_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint16_t crc = etl::crc16_xmodem_t4(data, data + 9); + + CHECK_EQUAL(0x31C3U, crc); + } +#endif + //************************************************************************* TEST(test_crc16_xmodem_4_add_values) { diff --git a/test/test_crc32.cpp b/test/test_crc32.cpp index bbc278e5b..2cfa169fc 100644 --- a/test/test_crc32.cpp +++ b/test/test_crc32.cpp @@ -127,6 +127,17 @@ namespace CHECK_EQUAL(0xCBF43926UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_t16(data, data + 9); + + CHECK_EQUAL(0xCBF43926UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_16_add_values) { @@ -199,6 +210,17 @@ namespace CHECK_EQUAL(0xCBF43926UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_t4(data, data + 9); + + CHECK_EQUAL(0xCBF43926UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_4_add_values) { diff --git a/test/test_crc32_bzip2.cpp b/test/test_crc32_bzip2.cpp index 76655dd0c..857fe0056 100644 --- a/test/test_crc32_bzip2.cpp +++ b/test/test_crc32_bzip2.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xFC891918UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_bzip2_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_bzip2(data, data + 9); + + CHECK_EQUAL(0xFC891918UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_bzip2_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xFC891918UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_bzip2_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_bzip2_t16(data, data + 9); + + CHECK_EQUAL(0xFC891918UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_bzip2_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xFC891918UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_bzip2_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_bzip2_t4(data, data + 9); + + CHECK_EQUAL(0xFC891918UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_bzip2_4_add_values) { diff --git a/test/test_crc32_c.cpp b/test/test_crc32_c.cpp index a0259eae8..a6010343c 100644 --- a/test/test_crc32_c.cpp +++ b/test/test_crc32_c.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xE3069283UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_c_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_c(data, data + 9); + + CHECK_EQUAL(0xE3069283UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_c_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xE3069283UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_c_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_c_t16(data, data + 9); + + CHECK_EQUAL(0xE3069283UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_c_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xE3069283UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_c_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_c_t4(data, data + 9); + + CHECK_EQUAL(0xE3069283UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_c_4_add_values) { diff --git a/test/test_crc32_d.cpp b/test/test_crc32_d.cpp index 8dc77f710..c6b33efbf 100644 --- a/test/test_crc32_d.cpp +++ b/test/test_crc32_d.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x87315576UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_d_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_d(data, data + 9); + + CHECK_EQUAL(0x87315576UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_d_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x87315576UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_d_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_d_t16(data, data + 9); + + CHECK_EQUAL(0x87315576UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_d_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x87315576UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_d_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_d_t4(data, data + 9); + + CHECK_EQUAL(0x87315576UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_d_4_add_values) { diff --git a/test/test_crc32_jamcrc.cpp b/test/test_crc32_jamcrc.cpp index 167b55de2..1bd48cb3d 100644 --- a/test/test_crc32_jamcrc.cpp +++ b/test/test_crc32_jamcrc.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x340BC6D9UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_jamcrc_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_jamcrc(data, data + 9); + + CHECK_EQUAL(0x340BC6D9UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_jamcrc_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x340BC6D9UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_jamcrc_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_jamcrc_t16(data, data + 9); + + CHECK_EQUAL(0x340BC6D9UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_jamcrc_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x340BC6D9UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_jamcrc_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_jamcrc_t4(data, data + 9); + + CHECK_EQUAL(0x340BC6D9UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_jamcrc_4_add_values) { diff --git a/test/test_crc32_mpeg2.cpp b/test/test_crc32_mpeg2.cpp index d297c3897..635a990f9 100644 --- a/test/test_crc32_mpeg2.cpp +++ b/test/test_crc32_mpeg2.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x0376E6E7UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_mpeg2_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_mpeg2(data, data + 9); + + CHECK_EQUAL(0x0376E6E7UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_mpeg2_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x0376E6E7UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_mpeg2_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_mpeg2_t16(data, data + 9); + + CHECK_EQUAL(0x0376E6E7UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_mpeg2_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x0376E6E7UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_mpeg2_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_mpeg2_t4(data, data + 9); + + CHECK_EQUAL(0x0376E6E7UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_mpeg2_4_add_values) { diff --git a/test/test_crc32_posix.cpp b/test/test_crc32_posix.cpp index df132d5c3..f01d2e4c5 100644 --- a/test/test_crc32_posix.cpp +++ b/test/test_crc32_posix.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x765E7680UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_posix_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_posix(data, data + 9); + + CHECK_EQUAL(0x765E7680UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_posix_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x765E7680UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_posix_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_posix_t16(data, data + 9); + + CHECK_EQUAL(0x765E7680UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_posix_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x765E7680UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_posix_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_posix_t4(data, data + 9); + + CHECK_EQUAL(0x765E7680UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_posix_4_add_values) { diff --git a/test/test_crc32_q.cpp b/test/test_crc32_q.cpp index 0d2dc2607..7404c51c8 100644 --- a/test/test_crc32_q.cpp +++ b/test/test_crc32_q.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x3010BF7FUL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_q_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_q(data, data + 9); + + CHECK_EQUAL(0x3010BF7FUL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_q_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x3010BF7FUL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_q_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_q_t16(data, data + 9); + + CHECK_EQUAL(0x3010BF7FUL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_q_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x3010BF7FUL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_q_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_q_t4(data, data + 9); + + CHECK_EQUAL(0x3010BF7FUL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_q_4_add_values) { diff --git a/test/test_crc32_xfer.cpp b/test/test_crc32_xfer.cpp index 4c886bbc9..96ed2ab46 100644 --- a/test/test_crc32_xfer.cpp +++ b/test/test_crc32_xfer.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xBD0BE338UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_xfer_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_xfer(data, data + 9); + + CHECK_EQUAL(0xBD0BE338UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_xfer_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xBD0BE338UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_xfer_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_xfer_t16(data, data + 9); + + CHECK_EQUAL(0xBD0BE338UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_xfer_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xBD0BE338UL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc32_xfer_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint32_t crc = etl::crc32_xfer_t4(data, data + 9); + + CHECK_EQUAL(0xBD0BE338UL, crc); + } +#endif + //************************************************************************* TEST(test_crc32_xfer_4_add_values) { diff --git a/test/test_crc64_ecma.cpp b/test/test_crc64_ecma.cpp index 1b32ce8fa..54a8d8cb2 100644 --- a/test/test_crc64_ecma.cpp +++ b/test/test_crc64_ecma.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x6C40DF5F0B497347ULL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc64_ecma_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint64_t crc = etl::crc64_ecma(data, data + 9); + + CHECK_EQUAL(0x6C40DF5F0B497347ULL, crc); + } +#endif + //************************************************************************* TEST(test_crc64_ecma_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x6C40DF5F0B497347ULL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc64_ecma_16_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint64_t crc = etl::crc64_ecma_t16(data, data + 9); + + CHECK_EQUAL(0x6C40DF5F0B497347ULL, crc); + } +#endif + //************************************************************************* TEST(test_crc64_ecma_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x6C40DF5F0B497347ULL, crc); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc64_ecma_4_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint64_t crc = etl::crc64_ecma_t4(data, data + 9); + + CHECK_EQUAL(0x6C40DF5F0B497347ULL, crc); + } +#endif + //************************************************************************* TEST(test_crc64_ecma_4_add_values) { diff --git a/test/test_crc8_ccitt.cpp b/test/test_crc8_ccitt.cpp index bb531a681..25cc048ec 100644 --- a/test/test_crc8_ccitt.cpp +++ b/test/test_crc8_ccitt.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xF4U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_ccitt_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_ccitt_t4(data, data + 9); + + CHECK_EQUAL(0xF4U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_ccitt_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xF4U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_ccitt_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_ccitt_t16(data, data + 9); + + CHECK_EQUAL(0xF4U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_ccitt_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xF4U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_ccitt_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_ccitt(data, data + 9); + + CHECK_EQUAL(0xF4U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_ccitt_256_add_values) { diff --git a/test/test_crc8_cdma2000.cpp b/test/test_crc8_cdma2000.cpp index bf43d73e5..df57b3a3c 100644 --- a/test/test_crc8_cdma2000.cpp +++ b/test/test_crc8_cdma2000.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xDAU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_cdma2000_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_cdma2000_t4(data, data + 9); + + CHECK_EQUAL(0xDAU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_cdma2000_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xDAU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_cdma2000_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_cdma2000_t16(data, data + 9); + + CHECK_EQUAL(0xDAU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_cdma2000_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xDAU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_cdma2000_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_cdma2000(data, data + 9); + + CHECK_EQUAL(0xDAU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_cdma2000_256_add_values) { diff --git a/test/test_crc8_darc.cpp b/test/test_crc8_darc.cpp index 098ca4ce9..d1fdb2010 100644 --- a/test/test_crc8_darc.cpp +++ b/test/test_crc8_darc.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x15U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_darc_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_darc_t4(data, data + 9); + + CHECK_EQUAL(0x15U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_darc_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x15U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_darc_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_darc_t16(data, data + 9); + + CHECK_EQUAL(0x15U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_darc_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x15U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_darc_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_darc(data, data + 9); + + CHECK_EQUAL(0x15U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_darc_256_add_values) { diff --git a/test/test_crc8_dvbs2.cpp b/test/test_crc8_dvbs2.cpp index 54667146e..0f5e2f910 100644 --- a/test/test_crc8_dvbs2.cpp +++ b/test/test_crc8_dvbs2.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xBCU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_dvbs2_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_dvbs2_t4(data, data + 9); + + CHECK_EQUAL(0xBCU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_dvbs2_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xBCU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_dvbs2_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_dvbs2_t16(data, data + 9); + + CHECK_EQUAL(0xBCU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_dvbs2_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xBCU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_dvbs2_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_dvbs2(data, data + 9); + + CHECK_EQUAL(0xBCU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_dvbs2_256_add_values) { diff --git a/test/test_crc8_ebu.cpp b/test/test_crc8_ebu.cpp index 0e378e934..9168cbdac 100644 --- a/test/test_crc8_ebu.cpp +++ b/test/test_crc8_ebu.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x97U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_ebu_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_ebu_t4(data, data + 9); + + CHECK_EQUAL(0x97U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_ebu_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x97U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_ebu_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_ebu_t16(data, data + 9); + + CHECK_EQUAL(0x97U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_ebu_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x97U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_ebu_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_ebu(data, data + 9); + + CHECK_EQUAL(0x97U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_ebu_256_add_values) { diff --git a/test/test_crc8_icode.cpp b/test/test_crc8_icode.cpp index 32fd5468b..bda008842 100644 --- a/test/test_crc8_icode.cpp +++ b/test/test_crc8_icode.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x7EU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_icode_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_icode_t4(data, data + 9); + + CHECK_EQUAL(0x7EU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_icode_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x7EU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_icode_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_icode_t16(data, data + 9); + + CHECK_EQUAL(0x7EU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_icode_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x7EU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_icode_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_icode(data, data + 9); + + CHECK_EQUAL(0x7EU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_icode_256_add_values) { diff --git a/test/test_crc8_itu.cpp b/test/test_crc8_itu.cpp index 6a14613fa..b6cf0b281 100644 --- a/test/test_crc8_itu.cpp +++ b/test/test_crc8_itu.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xA1U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_itu_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_itu_t4(data, data + 9); + + CHECK_EQUAL(0xA1U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_itu_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xA1U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_itu_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_itu_t16(data, data + 9); + + CHECK_EQUAL(0xA1U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_itu_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xA1U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_itu_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_itu(data, data + 9); + + CHECK_EQUAL(0xA1U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_itu_256_add_values) { diff --git a/test/test_crc8_j1850.cpp b/test/test_crc8_j1850.cpp index 1b50b14a5..24d67cc1e 100644 --- a/test/test_crc8_j1850.cpp +++ b/test/test_crc8_j1850.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x4BU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_j1850_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_j1850_t4(data, data + 9); + + CHECK_EQUAL(0x4BU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_j1850_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x4BU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_j1850_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_j1850_t16(data, data + 9); + + CHECK_EQUAL(0x4BU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_j1850_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x4BU, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_j1850_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_j1850(data, data + 9); + + CHECK_EQUAL(0x4BU, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_j1850_256_add_values) { diff --git a/test/test_crc8_j1850_zero.cpp b/test/test_crc8_j1850_zero.cpp index 3ab0bae36..1d179a3bf 100644 --- a/test/test_crc8_j1850_zero.cpp +++ b/test/test_crc8_j1850_zero.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x37U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_j1850_zero_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_j1850_zero_t4(data, data + 9); + + CHECK_EQUAL(0x37U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_j1850_zero_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x37U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_j1850_zero_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_j1850_zero_t16(data, data + 9); + + CHECK_EQUAL(0x37U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_j1850_zero_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x37U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_j1850_zero_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_j1850_zero(data, data + 9); + + CHECK_EQUAL(0x37U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_j1850_zero_256_add_values) { diff --git a/test/test_crc8_maxim.cpp b/test/test_crc8_maxim.cpp index 8c68d85cf..b9b6775c7 100644 --- a/test/test_crc8_maxim.cpp +++ b/test/test_crc8_maxim.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xA1U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_maxim_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_maxim_t4(data, data + 9); + + CHECK_EQUAL(0xA1U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_maxim_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xA1U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_maxim_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_maxim_t16(data, data + 9); + + CHECK_EQUAL(0xA1U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_maxim_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xA1U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_maxim_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_maxim(data, data + 9); + + CHECK_EQUAL(0xA1U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_maxim_256_add_values) { diff --git a/test/test_crc8_rohc.cpp b/test/test_crc8_rohc.cpp index 366474fce..f9dff5262 100644 --- a/test/test_crc8_rohc.cpp +++ b/test/test_crc8_rohc.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0xD0U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_rohc_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_rohc_t4(data, data + 9); + + CHECK_EQUAL(0xD0U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_rohc_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0xD0U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_rohc_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_rohc_t16(data, data + 9); + + CHECK_EQUAL(0xD0U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_rohc_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0xD0U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_rohc_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_rohc(data, data + 9); + + CHECK_EQUAL(0xD0U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_rohc_256_add_values) { diff --git a/test/test_crc8_wcdma.cpp b/test/test_crc8_wcdma.cpp index 7dfc5215d..8b3613a9f 100644 --- a/test/test_crc8_wcdma.cpp +++ b/test/test_crc8_wcdma.cpp @@ -55,6 +55,17 @@ namespace CHECK_EQUAL(0x25U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_wcdma_4_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_wcdma_t4(data, data + 9); + + CHECK_EQUAL(0x25U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_wcdma_4_add_values) { @@ -127,6 +138,17 @@ namespace CHECK_EQUAL(0x25U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_wcdma_16_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_wcdma_t16(data, data + 9); + + CHECK_EQUAL(0x25U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_wcdma_16_add_values) { @@ -199,6 +221,17 @@ namespace CHECK_EQUAL(0x25U, int(crc)); } +#if ETL_USING_CPP14 + //************************************************************************* + TEST(test_crc8_wcdma_256_constructor_constexpr) + { + constexpr char data[] = "123456789"; + constexpr uint8_t crc = etl::crc8_wcdma(data, data + 9); + + CHECK_EQUAL(0x25U, int(crc)); + } +#endif + //************************************************************************* TEST(test_crc8_wcdma_256_add_values) { From 6cefee08fa9bfbd86e9d4f19a0812cbd41ab7443 Mon Sep 17 00:00:00 2001 From: Zach O'Brien Date: Tue, 21 Jan 2025 11:10:08 -0700 Subject: [PATCH 2/3] Fix syntax when using c++03 or `ETL_FORCE_NO_ADVANCED_CPP` --- include/etl/frame_check_sequence.h | 4 +- include/etl/private/crc_implementation.h | 591 ++++++++++++----------- 2 files changed, 308 insertions(+), 287 deletions(-) diff --git a/include/etl/frame_check_sequence.h b/include/etl/frame_check_sequence.h index d959472dc..71bc31d43 100644 --- a/include/etl/frame_check_sequence.h +++ b/include/etl/frame_check_sequence.h @@ -107,7 +107,7 @@ namespace etl //************************************************************************* /// Default constructor. //************************************************************************* - ETL_CONSTEXPR14 frame_check_sequence() : frame_check{} + ETL_CONSTEXPR14 frame_check_sequence() : frame_check() { reset(); } @@ -118,7 +118,7 @@ namespace etl /// \param end End of the range. //************************************************************************* template - ETL_CONSTEXPR14 frame_check_sequence(TIterator begin, const TIterator end) : frame_check{} + ETL_CONSTEXPR14 frame_check_sequence(TIterator begin, const TIterator end) : frame_check() { ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Type not supported"); diff --git a/include/etl/private/crc_implementation.h b/include/etl/private/crc_implementation.h index 557e37d9b..5a9b90769 100644 --- a/include/etl/private/crc_implementation.h +++ b/include/etl/private/crc_implementation.h @@ -241,16 +241,21 @@ namespace etl struct crc_table { //************************************************************************* - static ETL_CONSTANT TAccumulator table[4U] = +#if !ETL_USING_CPP11 || defined(ETL_FORCE_NO_ADVANCED_CPP) + TAccumulator add(TAccumulator crc, uint8_t value) const { - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value - }; - +#endif + static ETL_CONSTANT TAccumulator table[4U] = + { + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value + }; +#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const { +#endif if ETL_IF_CONSTEXPR(Reflect) { crc = crc_update_chunk(crc, value, table); @@ -269,8 +274,10 @@ namespace etl return crc; } }; +#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) template ETL_CONSTANT TAccumulator crc_table::table[4U]; +#endif //********************************* // Table size of 16. @@ -278,28 +285,33 @@ namespace etl struct crc_table { //************************************************************************* - static ETL_CONSTANT TAccumulator table[16U] = +#if !ETL_USING_CPP11 || defined(ETL_FORCE_NO_ADVANCED_CPP) + TAccumulator add(TAccumulator crc, uint8_t value) const { - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value - }; - +#endif + static ETL_CONSTANT TAccumulator table[16U] = + { + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value + }; +#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const { +#endif if ETL_IF_CONSTEXPR(Reflect) { crc = crc_update_chunk(crc, value, table); @@ -314,8 +326,10 @@ namespace etl return crc; } }; +#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) template ETL_CONSTANT TAccumulator crc_table::table[16U]; +#endif //********************************* // Table size of 256. @@ -323,276 +337,283 @@ namespace etl struct crc_table { //************************************************************************* - static ETL_CONSTANT TAccumulator table[256U] = +#if !ETL_USING_CPP11 || defined(ETL_FORCE_NO_ADVANCED_CPP) + TAccumulator add(TAccumulator crc, uint8_t value) const { - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value, - crc_table_entry::value - }; +#endif + static ETL_CONSTANT TAccumulator table[256U]= + { + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value, + crc_table_entry::value + }; +#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const { +#endif crc = crc_update_chunk(crc, value, table); return crc; } }; +#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) template ETL_CONSTANT TAccumulator crc_table::table[256U]; - +#endif //***************************************************************************** // CRC Policies. //***************************************************************************** From e4e130fb3f5cea9dff53f8b0191d3e3df2adef8c Mon Sep 17 00:00:00 2001 From: Zach O'Brien Date: Wed, 22 Jan 2025 10:50:03 -0700 Subject: [PATCH 3/3] Remove use of `ETL_FORCE_NO_ADVANCED_CPP` option since it is no longer used. --- include/etl/private/crc_implementation.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/etl/private/crc_implementation.h b/include/etl/private/crc_implementation.h index 5a9b90769..9e6429074 100644 --- a/include/etl/private/crc_implementation.h +++ b/include/etl/private/crc_implementation.h @@ -241,7 +241,7 @@ namespace etl struct crc_table { //************************************************************************* -#if !ETL_USING_CPP11 || defined(ETL_FORCE_NO_ADVANCED_CPP) +#if !ETL_USING_CPP11 TAccumulator add(TAccumulator crc, uint8_t value) const { #endif @@ -252,7 +252,7 @@ namespace etl crc_table_entry::value, crc_table_entry::value }; -#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) +#if ETL_USING_CPP11 ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const { #endif @@ -274,7 +274,7 @@ namespace etl return crc; } }; -#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) +#if ETL_USING_CPP11 template ETL_CONSTANT TAccumulator crc_table::table[4U]; #endif @@ -285,7 +285,7 @@ namespace etl struct crc_table { //************************************************************************* -#if !ETL_USING_CPP11 || defined(ETL_FORCE_NO_ADVANCED_CPP) +#if !ETL_USING_CPP11 TAccumulator add(TAccumulator crc, uint8_t value) const { #endif @@ -308,7 +308,7 @@ namespace etl crc_table_entry::value, crc_table_entry::value }; -#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) +#if ETL_USING_CPP11 ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const { #endif @@ -326,7 +326,7 @@ namespace etl return crc; } }; -#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) +#if ETL_USING_CPP11 template ETL_CONSTANT TAccumulator crc_table::table[16U]; #endif @@ -337,7 +337,7 @@ namespace etl struct crc_table { //************************************************************************* -#if !ETL_USING_CPP11 || defined(ETL_FORCE_NO_ADVANCED_CPP) +#if !ETL_USING_CPP11 TAccumulator add(TAccumulator crc, uint8_t value) const { #endif @@ -600,7 +600,7 @@ namespace etl crc_table_entry::value, crc_table_entry::value }; -#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) +#if ETL_USING_CPP11 ETL_CONSTEXPR14 TAccumulator add(TAccumulator crc, uint8_t value) const { #endif @@ -610,7 +610,7 @@ namespace etl return crc; } }; -#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP) +#if ETL_USING_CPP11 template ETL_CONSTANT TAccumulator crc_table::table[256U]; #endif