Intermediate commit

This commit is contained in:
John Wellbelove 2021-03-25 10:22:55 +00:00
parent a99473eb3f
commit 7e37fcf196
24 changed files with 494 additions and 155 deletions

View File

@ -42,7 +42,7 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc16_t = etl::crc_type<etl::private_crc::crc16_parameters, Table_Size>;
#else
@ -51,8 +51,6 @@ namespace etl
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************

View File

@ -32,7 +32,8 @@ SOFTWARE.
#define ETL_CRC16_AUG_CCITT_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#include "crc_implementation_2.h"
#include "crc_parameters.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
@ -45,12 +46,16 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc16_aug_ccitt_t = etl::crc_type<etl::private_crc::crc16_aug_ccitt_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc16_aug_ccitt_t : public etl::private_crc::crc_type<uint16_t, 0x1021U, 0x1D0FU, 0x0000U, false, Table_Size>
class crc16_aug_ccitt_t : public etl::crc_type<etl::private_crc::crc16_aug_ccitt_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
@ -72,6 +77,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc16_aug_ccitt_t<256U> crc16_aug_ccitt_t256;
typedef etl::crc::crc16_aug_ccitt_t<16U> crc16_aug_ccitt_t16;

View File

@ -32,11 +32,8 @@ SOFTWARE.
#define ETL_CRC16_CCITT_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc16_ccitt 16 bit CRC calculation
///\ingroup crc
@ -45,13 +42,15 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
class crc16_ccitt_t : public etl::private_crc::crc_type<uint16_t, 0x1021U, 0xFFFFU, 0x0000U, false, Table_Size>
using crc16_ccitt_t = etl::crc_type<etl::private_crc::crc16_ccitt_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc16_ccitt_t : public etl::crc_type<etl::private_crc::crc16_ccitt_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -72,6 +71,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc16_ccitt_t<256U> crc16_ccitt_t256;
typedef etl::crc::crc16_ccitt_t<16U> crc16_ccitt_t16;

View File

@ -32,11 +32,8 @@ SOFTWARE.
#define ETL_CRC16_GENIBUS_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc16_genibus 16 bit CRC calculation
///\ingroup crc
@ -45,13 +42,15 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc16_genibus_t = etl::crc_type<etl::private_crc::crc16_genibus_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc16_genibus_t : public etl::private_crc::crc_type<uint16_t, 0x1021U, 0xFFFFU, 0xFFFFU, false, Table_Size>
class crc16_genibus_t : public etl::crc_type<etl::private_crc::crc16_genibus_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -72,6 +71,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc16_genibus_t<256U> crc16_genibus_t256;
typedef etl::crc::crc16_genibus_t<16U> crc16_genibus_t16;

View File

@ -32,11 +32,8 @@ SOFTWARE.
#define ETL_CRC16_KERMIT_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc16_kermit 16 bit CRC calculation
///\ingroup crc
@ -45,13 +42,15 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc16_kermit_t = etl::crc_type<etl::private_crc::crc16_kermit_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc16_kermit_t : public etl::private_crc::crc_type<uint16_t, 0x1021U,0x0000U, 0x0000U, true, Table_Size>
class crc16_kermit_t : public etl::crc_type<etl::private_crc::crc16_kermit_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -72,6 +71,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc16_kermit_t<256U> crc16_kermit_t256;
typedef etl::crc::crc16_kermit_t<16U> crc16_kermit_t16;

View File

@ -32,26 +32,25 @@ SOFTWARE.
#define ETL_CRC16_MODBUS_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#include "crc_implementation_2.h"
#include "crc_parameters.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
///\defgroup crc16_modbus 16 bit CRC calculation
//\defgroup crc16_modbus 16 bit CRC calculation
///\ingroup crc
namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc16_modbus_t = etl::crc_type<etl::private_crc::crc16_modbus_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc16_modbus_t : public etl::private_crc::crc_type<uint16_t, 0x8005U, 0xFFFFU, 0x0000U, true, Table_Size>
class crc16_modbus_t : public etl::crc_type<etl::private_crc::crc16_modbus_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -72,6 +71,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc16_modbus_t<256U> crc16_modbus_t256;
typedef etl::crc::crc16_modbus_t<16U> crc16_modbus_t16;

View File

@ -32,11 +32,8 @@ SOFTWARE.
#define ETL_CRC16_USB_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc16_usb 16 bit CRC calculation
///\ingroup crc
@ -45,13 +42,15 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc16_usb_t = etl::crc_type<etl::private_crc::crc16_usb_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc16_usb_t : public etl::private_crc::crc_type<uint16_t, 0x8005U, 0xFFFFU, 0xFFFFU, true, Table_Size>
class crc16_usb_t : public etl::crc_type<etl::private_crc::crc16_usb_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -72,6 +71,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc16_usb_t<256U> crc16_usb_t256;
typedef etl::crc::crc16_usb_t<16U> crc16_usb_t16;

View File

@ -32,11 +32,8 @@ SOFTWARE.
#define ETL_CRC16_X25_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc16_x25 16 bit CRC calculation
///\ingroup crc
@ -45,13 +42,15 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc16_x25_t = etl::crc_type<etl::private_crc::crc16_x25_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc16_x25_t : public etl::private_crc::crc_type<uint16_t, 0x1021, 0xFFFFU, 0xFFFFU, true, Table_Size>
class crc16_x25_t : public etl::private_crc::crc_type<etl::private_crc::crc16_x25_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -72,6 +71,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc16_x25_t<256U> crc16_x25_t256;
typedef etl::crc::crc16_x25_t<16U> crc16_x25_t16;

View File

@ -32,11 +32,8 @@ SOFTWARE.
#define ETL_CRC16_XMODEM_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc16_xmodem 16 bit CRC calculation
///\ingroup crc
@ -47,15 +44,13 @@ namespace etl
{
#if ETL_CPP11_SUPPORTED
template <size_t Table_Size>
using crc16_xmodem_t = etl::private_crc::crc_type<uint16_t, 0x1021, 0x0000U, 0x0000U, false, Table_Size>;
using crc16_xmodem_t = etl::crc_type<etl::private_crc::crc16_xmodem_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc16_xmodem_t : public etl::private_crc::crc_type<uint16_t, 0x1021, 0x0000U, 0x0000U, false, Table_Size>
class crc16_xmodem_t : public etl::crc_type<etl::private_crc::crc16_xmodem_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************

View File

@ -32,11 +32,8 @@ SOFTWARE.
#define ETL_CRC32_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc32 32 bit CRC calculation
///\ingroup crc
@ -45,13 +42,15 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
template <size_t Table_Size>
class crc32_t : public etl::private_crc::crc_type<uint32_t, 0X04C11DB7U, 0xFFFFFFFFU, 0xFFFFFFFFU, true, Table_Size>
using crc32_t = etl::crc_type<etl::private_crc::crc32_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc32_t : public etl::crc_type<etl::private_crc::crc32_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -72,6 +71,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc32_t<256U> crc32_t256;
typedef etl::crc::crc32_t<16U> crc32_t16;

View File

@ -0,0 +1,82 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2021 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_CRC32_BZIP2_EX_INCLUDED
#define ETL_CRC32_BZIP2_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc32_bzip2 32 bit CRC BZIP2 calculation
///\ingroup crc
namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
template <size_t Table_Size>
using crc32_bzip2_t = etl::crc_type<etl::private_crc::crc32_bzip2_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc32_bzip2_t : public etl::crc_type<etl::private_crc::crc32_bzip2_parameters, Table_Size>
{
public:
//*************************************************************************
/// Default constructor.
//*************************************************************************
crc32_bzip2_t()
{
this->reset();
}
//*************************************************************************
/// Constructor from range.
/// \param begin Start of the range.
/// \param end End of the range.
//*************************************************************************
template<typename TIterator>
crc32_bzip2_t(TIterator begin, const TIterator end)
{
this->reset();
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc32_bzip2_t<256U> crc32_bzip2_t256;
typedef etl::crc::crc32_bzip2_t<16U> crc32_bzip2_t16;
typedef etl::crc::crc32_bzip2_t<4U> crc32_bzip2_t4;
typedef crc32_bzip2_t256 crc32_bzip2;
}
}
#endif

View File

@ -0,0 +1,82 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2021 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_CRC32_C_EX_INCLUDED
#define ETL_CRC32_C_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc32_c 32 bit CRC_C calculation
///\ingroup crc
namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
template <size_t Table_Size>
using crc32_c_t = etl::crc_type<etl::private_crc::crc32_c_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc32_c_t : public etl::crc_type<etl::private_crc::crc32_c_parameters, Table_Size>
{
public:
//*************************************************************************
/// Default constructor.
//*************************************************************************
crc32_c_t()
{
this->reset();
}
//*************************************************************************
/// Constructor from range.
/// \param begin Start of the range.
/// \param end End of the range.
//*************************************************************************
template<typename TIterator>
crc32_c_t(TIterator begin, const TIterator end)
{
this->reset();
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc32_c_t<256U> crc32_c_t256;
typedef etl::crc::crc32_c_t<16U> crc32_c_t16;
typedef etl::crc::crc32_c_t<4U> crc32_c_t4;
typedef crc32_c_t256 crc32_c;
}
}
#endif

View File

@ -0,0 +1,82 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2021 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_CRC32_BZIP2_EX_INCLUDED
#define ETL_CRC32_BZIP2_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc32_bzip2 32 bit CRC BZIP2 calculation
///\ingroup crc
namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
template <size_t Table_Size>
using crc32_bzip2_t = etl::crc_type<etl::private_crc::crc32_bzip2_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc32_bzip2_t : public etl::crc_type<etl::private_crc::crc32_bzip2_parameters, Table_Size>
{
public:
//*************************************************************************
/// Default constructor.
//*************************************************************************
crc32_bzip2_t()
{
this->reset();
}
//*************************************************************************
/// Constructor from range.
/// \param begin Start of the range.
/// \param end End of the range.
//*************************************************************************
template<typename TIterator>
crc32_bzip2_t(TIterator begin, const TIterator end)
{
this->reset();
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc32_bzip2_t<256U> crc32_bzip2_t256;
typedef etl::crc::crc32_bzip2_t<16U> crc32_bzip2_t16;
typedef etl::crc::crc32_bzip2_t<4U> crc32_bzip2_t4;
typedef crc32_bzip2_t256 crc32_bzip2;
}
}
#endif

View File

@ -0,0 +1,82 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2021 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_CRC32_POSIX_EX_INCLUDED
#define ETL_CRC32_POSIX_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc32_posix 32 bit CRC POSIX calculation
///\ingroup crc
namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
template <size_t Table_Size>
using crc32_posix_t = etl::crc_type<etl::private_crc::crc32_posix_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc32_posix_t : public etl::crc_type<etl::private_crc::crc32_posix_parameters, Table_Size>
{
public:
//*************************************************************************
/// Default constructor.
//*************************************************************************
crc32_posix_t()
{
this->reset();
}
//*************************************************************************
/// Constructor from range.
/// \param begin Start of the range.
/// \param end End of the range.
//*************************************************************************
template<typename TIterator>
crc32_posix_t(TIterator begin, const TIterator end)
{
this->reset();
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc32_posix_t<256U> crc32_posix_t256;
typedef etl::crc::crc32_posix_t<16U> crc32_posix_t16;
typedef etl::crc::crc32_posix_t<4U> crc32_posix_t4;
typedef crc32_posix_t256 crc32_posix;
}
}
#endif

View File

@ -32,11 +32,8 @@ SOFTWARE.
#define ETL_CRC64_ECMA_EX_INCLUDED
#include "../platform.h"
#include "crc_implementation.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif
#include "crc_implementation_2.h"
#include "crc_parameters.h"
///\defgroup crc64_ecma 64 bit ECMA CRC calculation
///\ingroup crc
@ -45,13 +42,15 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
template <size_t Table_Size>
class crc64_ecma_t : public etl::private_crc::crc_type<uint64_t, 0x42F0E1EBA9EA3693U, 0x0000000000000000U, 0x0000000000000000U, false, Table_Size>
using crc64_ecma_t = etl::crc_type<etl::private_crc::crc64_ecma_parameters, Table_Size>;
#else
template <size_t Table_Size>
class crc64_ecma_t : public etl::crc_type<etl::private_crc::crc64_ecma_parameters, Table_Size>
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -72,6 +71,7 @@ namespace etl
this->add(begin, end);
}
};
#endif
typedef etl::crc::crc64_ecma_t<256U> crc64_ecma_t256;
typedef etl::crc::crc64_ecma_t<16U> crc64_ecma_t16;

View File

@ -39,7 +39,7 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc8_ccitt_t = etl::crc_type<etl::private_crc::crc8_ccitt_parameters, Table_Size>;
#else
@ -48,8 +48,6 @@ namespace etl
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************

View File

@ -42,7 +42,7 @@ namespace etl
{
namespace crc
{
#if ETL_CPP11_SUPPORTED
#if ETL_CPP11_SUPPORTED && !ETL_CRC_FORCE_CPP03
template <size_t Table_Size>
using crc8_rohc_t = etl::crc_type<etl::private_crc::crc8_rohc_parameters, Table_Size>;
#else
@ -51,8 +51,6 @@ namespace etl
{
public:
ETL_STATIC_ASSERT((Table_Size == 4U) || (Table_Size == 16U) || (Table_Size == 256U), "Table size must be 4, 16 or 256");
//*************************************************************************
/// Default constructor.
//*************************************************************************

View File

@ -191,13 +191,13 @@ namespace etl
}
//*****************************************************************************
//
// CRC Policies.
//*****************************************************************************
template <typename TCrcParameters, size_t Table_Size>
struct crc_policy;
//*********************************
// Policy for 256 sized table.
// Policy for 256 entry table.
template <typename TCrcParameters>
struct crc_policy<TCrcParameters, 256U>
{
@ -491,7 +491,7 @@ namespace etl
};
//*********************************
// Policy for 16 sized table.
// Policy for 16 entry table.
template <typename TCrcParameters>
struct crc_policy<TCrcParameters, 16U>
{
@ -560,7 +560,7 @@ namespace etl
};
//*********************************
// Policy for 4 sized table.
// Policy for 4 entry table.
template <typename TCrcParameters>
struct crc_policy<TCrcParameters, 4U>
{

View File

@ -31,13 +31,17 @@ namespace etl
typedef crc_parameters<uint16_t, 0x8005U, 0xFFFFU, 0x0000U, true> crc16_modbus_parameters;
typedef crc_parameters<uint16_t, 0x8005U, 0xFFFFU, 0xFFFFU, true> crc16_usb_parameters;
typedef crc_parameters<uint16_t, 0x1021U, 0xFFFFU, 0xFFFFU, true> crc16_x25_parameters;
typedef crc_parameters<uint16_t, 0x1021, 0x0000U, 0x0000U, false> crc16_xmodem_parameters;
typedef crc_parameters<uint16_t, 0x1021U, 0x0000U, 0x0000U, false> crc16_xmodem_parameters;
// 32 bit.
typedef crc_parameters<uint32_t, 0X04C11DB7U, 0xFFFFFFFFU, 0xFFFFFFFFU, true> crc32_parameters;
typedef crc_parameters<uint32_t, 0x04C11DB7U, 0xFFFFFFFFU, 0xFFFFFFFFU, true> crc32_parameters;
typedef crc_parameters<uint32_t, 0x1EDC6F41U, 0xFFFFFFFFU, 0xFFFFFFFFU, true> crc32_c_parameters;
typedef crc_parameters<uint32_t, 0x04C11DB7U, 0xFFFFFFFFU, 0xFFFFFFFFU, false> crc32_bzip2_parameters;
typedef crc_parameters<uint32_t, 0x04C11DB7U, 0xFFFFFFFFU, 0x00000000U, false> crc32_mpeg2_parameters;
typedef crc_parameters<uint32_t, 0x04C11DB7U, 0x00000000U, 0xFFFFFFFFU, false> crc32_posix_parameters;
// 64 bit.
typedef crc_parameters<uint64_t, 0x42F0E1EBA9EA3693U, 0x0000000000000000U, 0x0000000000000000U, false> crc64_ecma_parameters;
typedef crc_parameters<uint64_t, 0x42F0E1EBA9EA3693U, 0x0000000000000000U, 0x0000000000000000U, false> crc64_ecma_parameters;
}
}

View File

@ -59,10 +59,10 @@ namespace etl
template <>
struct integral_limits<void>
{
static const int min = 0;
static const int max = 0;
static const int bits = 0;
static const bool is_signed = false;
static ETL_CONSTANT int min = 0;
static ETL_CONSTANT int max = 0;
static ETL_CONSTANT int bits = 0;
static ETL_CONSTANT bool is_signed = false;
};
//***************************************************************************
@ -71,10 +71,10 @@ namespace etl
template <>
struct integral_limits<signed char>
{
static const signed char min = SCHAR_MIN;
static const signed char max = SCHAR_MAX;
static const int bits = CHAR_BIT;
static const bool is_signed = etl::is_signed<signed char>::value;
static ETL_CONSTANT signed char min = SCHAR_MIN;
static ETL_CONSTANT signed char max = SCHAR_MAX;
static ETL_CONSTANT int bits = CHAR_BIT;
static ETL_CONSTANT bool is_signed = etl::is_signed<signed char>::value;
};
//***************************************************************************
@ -83,10 +83,10 @@ namespace etl
template <>
struct integral_limits<unsigned char>
{
static const unsigned char min = 0;
static const unsigned char max = UCHAR_MAX;
static const int bits = CHAR_BIT;
static const bool is_signed = etl::is_signed<unsigned char>::value;
static ETL_CONSTANT unsigned char min = 0;
static ETL_CONSTANT unsigned char max = UCHAR_MAX;
static ETL_CONSTANT int bits = CHAR_BIT;
static ETL_CONSTANT bool is_signed = etl::is_signed<unsigned char>::value;
};
//***************************************************************************
@ -95,10 +95,10 @@ namespace etl
template <>
struct integral_limits<char>
{
static const char min = (etl::is_signed<char>::value) ? SCHAR_MIN : 0;
static const char max = (etl::is_signed<char>::value) ? SCHAR_MAX : char(UCHAR_MAX);
static const int bits = CHAR_BIT;
static const bool is_signed = etl::is_signed<char>::value;
static ETL_CONSTANT char min = (etl::is_signed<char>::value) ? SCHAR_MIN : 0;
static ETL_CONSTANT char max = (etl::is_signed<char>::value) ? SCHAR_MAX : char(UCHAR_MAX);
static ETL_CONSTANT int bits = CHAR_BIT;
static ETL_CONSTANT bool is_signed = etl::is_signed<char>::value;
};
//***************************************************************************
@ -107,10 +107,10 @@ namespace etl
template <>
struct integral_limits<short>
{
static const short min = SHRT_MIN;
static const short max = SHRT_MAX;
static const int bits = CHAR_BIT * (sizeof(short) / sizeof(char));
static const bool is_signed = etl::is_signed<short>::value;
static ETL_CONSTANT short min = SHRT_MIN;
static ETL_CONSTANT short max = SHRT_MAX;
static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(short) / sizeof(char));
static ETL_CONSTANT bool is_signed = etl::is_signed<short>::value;
};
//***************************************************************************
@ -119,10 +119,10 @@ namespace etl
template <>
struct integral_limits<unsigned short>
{
static const unsigned short min = 0;
static const unsigned short max = USHRT_MAX;
static const int bits = CHAR_BIT * (sizeof(unsigned short) / sizeof(char));
static const bool is_signed = etl::is_signed<unsigned short>::value;
static ETL_CONSTANT unsigned short min = 0;
static ETL_CONSTANT unsigned short max = USHRT_MAX;
static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(unsigned short) / sizeof(char));
static ETL_CONSTANT bool is_signed = etl::is_signed<unsigned short>::value;
};
//***************************************************************************
@ -131,10 +131,10 @@ namespace etl
template <>
struct integral_limits<int>
{
static const int min = INT_MIN;
static const int max = INT_MAX;
static const int bits = CHAR_BIT * (sizeof(int) / sizeof(char));
static const bool is_signed = etl::is_signed<int>::value;
static ETL_CONSTANT int min = INT_MIN;
static ETL_CONSTANT int max = INT_MAX;
static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(int) / sizeof(char));
static ETL_CONSTANT bool is_signed = etl::is_signed<int>::value;
};
//***************************************************************************
@ -143,10 +143,10 @@ namespace etl
template <>
struct integral_limits<unsigned int>
{
static const unsigned int min = 0;
static const unsigned int max = UINT_MAX;
static const int bits = CHAR_BIT * (sizeof(unsigned int) / sizeof(char));
static const bool is_signed = etl::is_signed<unsigned int>::value;
static ETL_CONSTANT unsigned int min = 0;
static ETL_CONSTANT unsigned int max = UINT_MAX;
static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(unsigned int) / sizeof(char));
static ETL_CONSTANT bool is_signed = etl::is_signed<unsigned int>::value;
};
//***************************************************************************
@ -155,10 +155,10 @@ namespace etl
template <>
struct integral_limits<long>
{
static const long min = LONG_MIN;
static const long max = LONG_MAX;
static const int bits = CHAR_BIT * (sizeof(long) / sizeof(char));
static const bool is_signed = etl::is_signed<long>::value;
static ETL_CONSTANT long min = LONG_MIN;
static ETL_CONSTANT long max = LONG_MAX;
static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(long) / sizeof(char));
static ETL_CONSTANT bool is_signed = etl::is_signed<long>::value;
};
//***************************************************************************
@ -167,10 +167,10 @@ namespace etl
template <>
struct integral_limits<unsigned long>
{
static const unsigned long min = 0;
static const unsigned long max = ULONG_MAX;
static const int bits = CHAR_BIT * (sizeof(unsigned long) / sizeof(char));
static const bool is_signed = etl::is_signed<unsigned long>::value;
static ETL_CONSTANT unsigned long min = 0;
static ETL_CONSTANT unsigned long max = ULONG_MAX;
static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(unsigned long) / sizeof(char));
static ETL_CONSTANT bool is_signed = etl::is_signed<unsigned long>::value;
};
#ifndef LLONG_MAX
@ -191,10 +191,10 @@ namespace etl
template <>
struct integral_limits<long long>
{
static const long long min = LLONG_MIN;
static const long long max = LLONG_MAX;
static const int bits = CHAR_BIT * (sizeof(long long) / sizeof(char));
static const bool is_signed = etl::is_signed<long long>::value;
static ETL_CONSTANT long long min = LLONG_MIN;
static ETL_CONSTANT long long max = LLONG_MAX;
static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(long long) / sizeof(char));
static ETL_CONSTANT bool is_signed = etl::is_signed<long long>::value;
};
//***************************************************************************
@ -203,10 +203,10 @@ namespace etl
template <>
struct integral_limits<unsigned long long>
{
static const unsigned long long min = 0;
static const unsigned long long max = ULLONG_MAX;
static const int bits = CHAR_BIT * (sizeof(unsigned long long) / sizeof(char));
static const bool is_signed = etl::is_signed<unsigned long long>::value;
static ETL_CONSTANT unsigned long long min = 0;
static ETL_CONSTANT unsigned long long max = ULLONG_MAX;
static ETL_CONSTANT int bits = CHAR_BIT * (sizeof(unsigned long long) / sizeof(char));
static ETL_CONSTANT bool is_signed = etl::is_signed<unsigned long long>::value;
};
}

Binary file not shown.

View File

@ -36,16 +36,16 @@ SOFTWARE.
#include "etl/experimental/crc8_ccitt.h"
#include "etl/experimental/crc8_rohc.h"
#include "etl/experimental/crc16.h"
//#include "etl/experimental/crc16_aug_ccitt.h"
//#include "etl/experimental/crc16_ccitt.h"
//#include "etl/experimental/crc16_kermit.h"
//#include "etl/experimental/crc16_modbus.h"
//#include "etl/experimental/crc16_usb.h"
//#include "etl/experimental/crc16_genibus.h"
//#include "etl/experimental/crc16_x25.h"
//#include "etl/experimental/crc16_xmodem.h"
//#include "etl/experimental/crc32.h"
//#include "etl/experimental/crc64_ecma.h"
#include "etl/experimental/crc16_aug_ccitt.h"
#include "etl/experimental/crc16_ccitt.h"
#include "etl/experimental/crc16_kermit.h"
#include "etl/experimental/crc16_modbus.h"
#include "etl/experimental/crc16_usb.h"
#include "etl/experimental/crc16_genibus.h"
#include "etl/experimental/crc16_x25.h"
#include "etl/experimental/crc16_xmodem.h"
#include "etl/experimental/crc32.h"
#include "etl/experimental/crc64_ecma.h"
//#include "etl/crc32_c.h"
//#include "etl/crc32_bzip2.h"

View File

@ -1273,7 +1273,6 @@
<ClInclude Include="..\..\include\etl\delegate.h" />
<ClInclude Include="..\..\include\etl\delegate_service.h" />
<ClInclude Include="..\..\include\etl\experimental\crc16.h" />
<ClInclude Include="..\..\include\etl\experimental\crc16_aug_ccitt.h" />
<ClInclude Include="..\..\include\etl\experimental\crc16_ccitt.h" />
<ClInclude Include="..\..\include\etl\experimental\crc16_genibus.h" />
<ClInclude Include="..\..\include\etl\experimental\crc16_kermit.h" />
@ -1282,6 +1281,10 @@
<ClInclude Include="..\..\include\etl\experimental\crc16_x25.h" />
<ClInclude Include="..\..\include\etl\experimental\crc16_xmodem.h" />
<ClInclude Include="..\..\include\etl\experimental\crc32.h" />
<ClInclude Include="..\..\include\etl\experimental\crc32_bzip2.h" />
<ClInclude Include="..\..\include\etl\experimental\crc32_c.h" />
<ClInclude Include="..\..\include\etl\experimental\crc32_mpeg2.h" />
<ClInclude Include="..\..\include\etl\experimental\crc32_posix.h" />
<ClInclude Include="..\..\include\etl\experimental\crc64_ecma.h" />
<ClInclude Include="..\..\include\etl\experimental\crc8_rohc.h" />
<ClInclude Include="..\..\include\etl\experimental\crc8_ccitt.h" />

View File

@ -1002,9 +1002,6 @@
<ClInclude Include="..\..\include\etl\experimental\crc32.h">
<Filter>ETL\Maths\Experimental</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\experimental\crc16_aug_ccitt.h">
<Filter>ETL\Maths\Experimental</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\experimental\crc16_ccitt.h">
<Filter>ETL\Maths\Experimental</Filter>
</ClInclude>
@ -1035,6 +1032,18 @@
<ClInclude Include="..\..\include\etl\experimental\crc_implementation_2.h">
<Filter>ETL\Maths\Experimental</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\experimental\crc32_bzip2.h">
<Filter>ETL\Maths\Experimental</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\experimental\crc32_c.h">
<Filter>ETL\Maths\Experimental</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\experimental\crc32_mpeg2.h">
<Filter>ETL\Maths\Experimental</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\experimental\crc32_posix.h">
<Filter>ETL\Maths\Experimental</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\main.cpp">