diff --git a/crc16.cpp b/crc16.cpp index 425f227a..570a2a6c 100644 --- a/crc16.cpp +++ b/crc16.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include namespace etl { diff --git a/crc16.h b/crc16.h index 31d33bef..5ad7f806 100644 --- a/crc16.h +++ b/crc16.h @@ -29,13 +29,13 @@ SOFTWARE. #ifndef __ETL_CRC16__ #define __ETL_CRC16__ -#include +#include #include "static_assert.h" #include "type_traits.h" #include "endian.h" -///\defgroup crc16 Sixteen bit CRC calculation +///\defgroup crc16 16 bit CRC calculation ///\ingroup crc namespace etl @@ -48,6 +48,7 @@ namespace etl //*************************************************************************** /// Calculates CRC16 using polynomial 0x8005. + ///\tparam ENDIANNESS The endianness of the calculation for input types larger than uint8_t. Default = endian::little. /// \ingroup crc16 //*************************************************************************** template @@ -69,7 +70,6 @@ namespace etl /// Constructor from range. /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template crc16(TIterator begin, const TIterator end) @@ -88,12 +88,11 @@ namespace etl //************************************************************************* /// \param value The value to add to the CRC. - /// \return The CRC result. //************************************************************************* template - value_type add(TValue value) + void add(TValue value) { - static_assert(is_integral::value, "Non-integral parameter"); + STATIC_ASSERT(is_integral::value, "Non-integral parameter"); if (ENDIANNESS == endian::little) { @@ -109,36 +108,29 @@ namespace etl add(uint8_t((value >> (i * 8)) & 0xFF)); } } - - return crc; } //************************************************************************* /// \param value The uint8_t to add to the CRC. /// \return The CRC result. //************************************************************************* - value_type add(uint8_t value) + void add(uint8_t value) { crc = (crc >> 8) ^ CRC16[(crc ^ value) & 0xFF]; - - return crc; } //************************************************************************* /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template - value_type add(TIterator begin, const TIterator end) + void add(TIterator begin, const TIterator end) { while (begin != end) { add(*begin); ++begin; } - - return crc; } //************************************************************************* @@ -174,4 +166,4 @@ namespace etl }; } -#endif \ No newline at end of file +#endif diff --git a/crc16_ccitt.cpp b/crc16_ccitt.cpp index 5ddc96cb..3a56e952 100644 --- a/crc16_ccitt.cpp +++ b/crc16_ccitt.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include namespace etl { diff --git a/crc16_ccitt.h b/crc16_ccitt.h index cc3ad645..a7cdeab8 100644 --- a/crc16_ccitt.h +++ b/crc16_ccitt.h @@ -29,13 +29,13 @@ SOFTWARE. #ifndef __ETL_CRC16_CCITT__ #define __ETL_CRC16_CCITT__ -#include +#include #include "static_assert.h" #include "type_traits.h" #include "endian.h" -///\defgroup crc16_ccitt Sixteen bit CRC CCITT calculation +///\defgroup crc16_ccitt 16 bit CRC CCITT calculation ///\ingroup crc namespace etl @@ -48,6 +48,7 @@ namespace etl //*************************************************************************** /// Calculates CRC-CCITT using polynomial 0x1021 + ///\tparam ENDIANNESS The endianness of the calculation for input types larger than uint8_t. Default = endian::little. /// \ingroup crc16_ccitt //*************************************************************************** template @@ -69,7 +70,6 @@ namespace etl /// Constructor from range. /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template crc16_ccitt(TIterator begin, const TIterator end) @@ -88,12 +88,11 @@ namespace etl //************************************************************************* /// \param value The value to add to the CRC. - /// \return The CRC result. //************************************************************************* template - value_type add(TValue value) + void add(TValue value) { - static_assert(is_integral::value, "Non-integral parameter"); + STATIC_ASSERT(is_integral::value, "Non-integral parameter"); if (ENDIANNESS == endian::little) { @@ -109,36 +108,28 @@ namespace etl add(uint8_t((value >> (i * 8)) & 0xFF)); } } - - return crc; } //************************************************************************* /// \param value The uint8_t to add to the CRC. - /// \return The CRC result. //************************************************************************* - value_type add(uint8_t value) + void add(uint8_t value) { crc = (crc << 8) ^ CRC_CCITT[((crc >> 8) ^ value) & 0xFF]; - - return crc; } //************************************************************************* /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template - value_type add(TIterator begin, const TIterator end) + void add(TIterator begin, const TIterator end) { while (begin != end) { add(*begin); ++begin; } - - return crc; } //************************************************************************* @@ -174,4 +165,4 @@ namespace etl }; } -#endif \ No newline at end of file +#endif diff --git a/crc16_kermit.cpp b/crc16_kermit.cpp index 530ed470..a76c801b 100644 --- a/crc16_kermit.cpp +++ b/crc16_kermit.cpp @@ -26,13 +26,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include namespace etl { //*************************************************************************** /// CRC Kermit table - /// \ingroup crc + /// \ingroup crc16_kermit //*************************************************************************** extern const uint16_t CRC_KERMIT[] = { diff --git a/crc16_kermit.h b/crc16_kermit.h index 926c7cf0..3de579dd 100644 --- a/crc16_kermit.h +++ b/crc16_kermit.h @@ -29,13 +29,13 @@ SOFTWARE. #ifndef __etl_crc16_kermit__ #define __etl_crc16_kermit__ -#include +#include #include "static_assert.h" #include "type_traits.h" #include "endian.h" -///\defgroup crc16_kermit Sixteen bit CRC Kermit calculation +///\defgroup crc16_kermit 16 bit CRC Kermit calculation ///\ingroup crc namespace etl @@ -48,6 +48,7 @@ namespace etl //*************************************************************************** /// Calculates CRC-Kermit using polynomial 0x1021 + ///\tparam ENDIANNESS The endianness of the calculation for input types larger than uint8_t. Default = endian::little. /// \ingroup crc16_kermit //*************************************************************************** template @@ -69,7 +70,6 @@ namespace etl /// Constructor from range. /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template crc16_kermit(TIterator begin, const TIterator end) @@ -88,12 +88,11 @@ namespace etl //************************************************************************* /// \param value The value to add to the CRC. - /// \return The CRC result. //************************************************************************* template - value_type add(TValue value) + void add(TValue value) { - static_assert(is_integral::value, "Non-integral parameter"); + STATIC_ASSERT(is_integral::value, "Non-integral parameter"); if (ENDIANNESS == endian::little) { @@ -109,36 +108,28 @@ namespace etl add(uint8_t((value >> (i * 8)) & 0xFF)); } } - - return crc; } //************************************************************************* /// \param value The uint8_t to add to the CRC. - /// \return The CRC result. //************************************************************************* - value_type add(uint8_t value) + void add(uint8_t value) { crc = (crc >> 8) ^ CRC_KERMIT[(crc ^ value) & 0xFF]; - - return crc; } //************************************************************************* /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template - value_type add(TIterator begin, const TIterator end) + void add(TIterator begin, const TIterator end) { while (begin != end) { add(*begin); ++begin; } - - return crc; } //************************************************************************* @@ -174,4 +165,4 @@ namespace etl }; } -#endif \ No newline at end of file +#endif diff --git a/crc32.cpp b/crc32.cpp index 67208be0..426ef505 100644 --- a/crc32.cpp +++ b/crc32.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include namespace etl { diff --git a/crc32.h b/crc32.h index 39aa7f8c..1a2c494d 100644 --- a/crc32.h +++ b/crc32.h @@ -29,13 +29,13 @@ SOFTWARE. #ifndef __ETL_CRC32__ #define __ETL_CRC32__ -#include +#include #include "static_assert.h" #include "type_traits.h" #include "endian.h" -///\defgroup crc32 Thirty two bit CRC calculation +///\defgroup crc32 32 bit CRC calculation ///\ingroup crc namespace etl @@ -48,6 +48,7 @@ namespace etl //*************************************************************************** /// Calculates CRC32 using polynomial 0x04C11DB7. + ///\tparam ENDIANNESS The endianness of the calculation for input types larger than uint8_t. Default = endian::little. /// \ingroup crc32 //*************************************************************************** template @@ -69,7 +70,6 @@ namespace etl /// Constructor from range. /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template crc32(TIterator begin, const TIterator end) @@ -88,12 +88,11 @@ namespace etl //************************************************************************* /// \param value The value to add to the CRC. - /// \return The CRC result. //************************************************************************* template - value_type add(TValue value) + void add(TValue value) { - static_assert(is_integral::value, "Non-integral parameter"); + STATIC_ASSERT(is_integral::value, "Non-integral parameter"); if (ENDIANNESS == endian::little) { @@ -109,36 +108,28 @@ namespace etl add(uint8_t((value >> (i * 8)) & 0xFF)); } } - - return crc; } //************************************************************************* /// \param value The uint8_t to add to the CRC. - /// \return The CRC result. //************************************************************************* - value_type add(uint8_t value) + void add(uint8_t value) { crc = (crc >> 8) ^ CRC32[(crc ^ value) & 0xFF]; - - return crc; } //************************************************************************* /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template - value_type add(TIterator begin, const TIterator end) + void add(TIterator begin, const TIterator end) { while (begin != end) { add(*begin); ++begin; } - - return crc; } //************************************************************************* @@ -174,4 +165,4 @@ namespace etl }; } -#endif \ No newline at end of file +#endif diff --git a/crc64_ecma.cpp b/crc64_ecma.cpp index 4673bf38..895b61b6 100644 --- a/crc64_ecma.cpp +++ b/crc64_ecma.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include namespace etl { diff --git a/crc64_ecma.h b/crc64_ecma.h index df988b6d..5d3d063b 100644 --- a/crc64_ecma.h +++ b/crc64_ecma.h @@ -29,13 +29,13 @@ SOFTWARE. #ifndef __ETL_CRC64_ECMA__ #define __ETL_CRC64_ECMA__ -#include +#include #include "static_assert.h" #include "type_traits.h" #include "endian.h" -///\defgroup crc64_ecma Sixty four bit CRC ECMA calculation +///\defgroup crc64_ecma 64 bit CRC ECMA calculation ///\ingroup crc namespace etl @@ -48,6 +48,7 @@ namespace etl //*************************************************************************** /// Calculates CRC64-ECMA using polynomial 0x42F0E1EBA9EA3693. + ///\tparam ENDIANNESS The endianness of the calculation for input types larger than uint8_t. Default = endian::little. /// \ingroup crc64_ecma //*************************************************************************** template @@ -69,7 +70,6 @@ namespace etl /// Constructor from range. /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template crc64_ecma(TIterator begin, const TIterator end) @@ -88,12 +88,11 @@ namespace etl //************************************************************************* /// \param value The value to add to the CRC. - /// \return The CRC result. //************************************************************************* template - value_type add(TValue value) + void add(TValue value) { - static_assert(is_integral::value, "Non-integral parameter"); + STATIC_ASSERT(is_integral::value, "Non-integral parameter"); if (ENDIANNESS == endian::little) { @@ -109,36 +108,28 @@ namespace etl add(uint8_t((value >> (i * 8)) & 0xFF)); } } - - return crc; } //************************************************************************* /// \param value The value to add to the CRC. - /// \return The CRC result. //************************************************************************* - value_type add(uint8_t value) + void add(uint8_t value) { crc = (crc << 8) ^ CRC64_ECMA[((crc >> 56) ^ value) & 0xFF]; - - return crc; } //************************************************************************* /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template - value_type add(TIterator begin, const TIterator end) + void add(TIterator begin, const TIterator end) { while (begin != end) { add(*begin); ++begin; } - - return crc; } //************************************************************************* @@ -174,4 +165,4 @@ namespace etl }; } -#endif \ No newline at end of file +#endif diff --git a/crc8_ccitt.cpp b/crc8_ccitt.cpp index aaeb1a12..2a2c5ff0 100644 --- a/crc8_ccitt.cpp +++ b/crc8_ccitt.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include +#include namespace etl { diff --git a/crc8_ccitt.h b/crc8_ccitt.h index 1be6b590..2c473cbc 100644 --- a/crc8_ccitt.h +++ b/crc8_ccitt.h @@ -29,13 +29,13 @@ SOFTWARE. #ifndef __ETL_CRC8_CCITT__ #define __ETL_CRC8_CCITT__ -#include +#include #include "static_assert.h" #include "type_traits.h" #include "endian.h" -///\defgroup crc8_ccitt Eight bit CRC calculation +///\defgroup crc8_ccitt 8 bit CRC calculation ///\ingroup crc namespace etl @@ -48,6 +48,7 @@ namespace etl //*************************************************************************** /// Calculates CRC8 CCITT using polynomial 0x07. + ///\tparam ENDIANNESS The endianness of the calculation for input types larger than uint8_t. Default = endian::little. /// \ingroup crc8_ccitt //*************************************************************************** template @@ -69,7 +70,6 @@ namespace etl /// Constructor from range. /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template crc8_ccitt(TIterator begin, const TIterator end) @@ -88,12 +88,11 @@ namespace etl //************************************************************************* /// \param value The value to add to the CRC. - /// \return The CRC result. //************************************************************************* template - value_type add(TValue value) + void add(TValue value) { - static_assert(is_integral::value, "Non-integral parameter"); + STATIC_ASSERT(is_integral::value, "Non-integral parameter"); if (ENDIANNESS == endian::little) { @@ -109,35 +108,27 @@ namespace etl add(uint8_t((value >> (i * 8)) & 0xFF)); } } - - return crc; } //************************************************************************* /// \param value The char to add to the CRC. - /// \return The CRC result. //************************************************************************* - value_type add(uint8_t value) + void add(uint8_t value) { crc = CRC8_CCITT[crc ^ value]; - - return crc; } //************************************************************************* /// \param begin Start of the range. /// \param end End of the range. - /// \return The CRC result. //************************************************************************* template - value_type add(TIterator begin, const TIterator end) + void add(TIterator begin, const TIterator end) { while (begin != end) { add(*begin++); } - - return crc; } //************************************************************************* @@ -173,4 +164,4 @@ namespace etl }; } -#endif \ No newline at end of file +#endif