diff --git a/include/etl/algorithm.h b/include/etl/algorithm.h index ba94a610..463dfd32 100644 --- a/include/etl/algorithm.h +++ b/include/etl/algorithm.h @@ -552,9 +552,9 @@ namespace etl { if (i == std::find(begin1, i, *i)) { - int32_t n = std::count(begin2, end2, *i); + size_t n = std::count(begin2, end2, *i); - if (n == 0 || std::count(i, end1, *i) != n) + if (n == 0 || size_t(std::count(i, end1, *i)) != n) { return false; } @@ -583,9 +583,9 @@ namespace etl { if (i == std::find(begin1, i, *i)) { - int32_t n = std::count(begin2, end2, *i); + size_t n = std::count(begin2, end2, *i); - if (n == 0 || std::count(i, end1, *i) != n) + if (n == 0 || size_t(std::count(i, end1, *i)) != n) { return false; } @@ -619,9 +619,9 @@ namespace etl { if (i == std::find_if(begin1, i, std::bind1st(predicate, *i))) { - int32_t n = std::count(begin2, end2, *i); + size_t n = std::count(begin2, end2, *i); - if (n == 0 || std::count(i, end1, *i) != n) + if (n == 0 || size_t(std::count(i, end1, *i)) != n) { return false; } @@ -652,9 +652,9 @@ namespace etl { if (i == std::find_if(begin1, i, std::bind1st(predicate, *i))) { - int32_t n = std::count(begin2, end2, *i); + size_t n = std::count(begin2, end2, *i); - if (n == 0 || std::count(i, end1, *i) != n) + if (n == 0 || size_t(std::count(i, end1, *i)) != n) { return false; } diff --git a/include/etl/debug_count.h b/include/etl/debug_count.h index ab80a4c4..48ad3f97 100644 --- a/include/etl/debug_count.h +++ b/include/etl/debug_count.h @@ -88,6 +88,18 @@ namespace etl return *this; } + inline debug_count& operator +=(size_t n) + { + count += int32_t(n); + return *this; + } + + inline debug_count& operator -=(size_t n) + { + count -= int32_t(n); + return *this; + } + inline operator int32_t() { return count; diff --git a/include/etl/memory.h b/include/etl/memory.h index 2d440653..1f1e0ad5 100644 --- a/include/etl/memory.h +++ b/include/etl/memory.h @@ -92,7 +92,7 @@ namespace etl typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) { - count += std::distance(o_begin, o_end); + count += int32_t(std::distance(o_begin, o_end)); std::fill(o_begin, o_end, value); @@ -108,7 +108,7 @@ namespace etl typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) { - count += std::distance(o_begin, o_end); + count += int32_t(std::distance(o_begin, o_end)); etl::uninitialized_fill(o_begin, o_end, value); @@ -181,7 +181,7 @@ namespace etl uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count) { TOutputIterator o_end = std::copy(i_begin, i_end, o_begin); - count += std::distance(o_begin, o_end); + count += int32_t(std::distance(o_begin, o_end)); return o_end; } @@ -197,7 +197,7 @@ namespace etl { TOutputIterator o_end = etl::uninitialized_copy(i_begin, i_end, o_begin); - count += std::distance(o_begin, o_end); + count += int32_t(std::distance(o_begin, o_end)); return o_end; } @@ -305,7 +305,7 @@ namespace etl typename etl::enable_if::value_type>::value, void>::type uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count = std::distance(o_begin, o_end); + count = int32_t(std::distance(o_begin, o_end)); } //***************************************************************************** @@ -317,7 +317,7 @@ namespace etl typename etl::enable_if::value_type>::value, void>::type uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count += std::distance(o_begin, o_end); + count += int32_t(std::distance(o_begin, o_end)); etl::uninitialized_default_construct(o_begin, o_end); } @@ -533,7 +533,7 @@ namespace etl template void uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count += std::distance(o_begin, o_end); + count += int32_t(std::distance(o_begin, o_end)); etl::uninitialized_value_construct(o_begin, o_end); } @@ -649,7 +649,7 @@ namespace etl typename etl::enable_if::value_type>::value, void>::type destroy(TIterator i_begin, TIterator i_end, TCounter& count) { - count -= std::distance(i_begin, i_end); + count -= int32_t(std::distance(i_begin, i_end)); } //***************************************************************************** @@ -661,7 +661,7 @@ namespace etl typename etl::enable_if::value_type>::value, void>::type destroy(TIterator i_begin, TIterator i_end, TCounter& count) { - count -= std::distance(i_begin, i_end); + count -= int32_t(std::distance(i_begin, i_end)); while (i_begin != i_end) { diff --git a/include/etl/platform.h b/include/etl/platform.h index f1a4c4de..8eaba63e 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -28,16 +28,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ +#include + #ifndef __ETL_PLATFORM__ #define __ETL_PLATFORM__ // Some targets do not support 8bit types. #define ETL_8BIT_SUPPORT (CHAR_BIT == 8) +// Define a debug macro #if defined(_DEBUG) || defined(DEBUG) #define ETL_DEBUG #endif +// Undefine all of the macros. +#undef ETL_PLATFORM_16BIT +#undef ETL_PLATFORM_32BIT +#undef ETL_PLATFORM_64BIT #undef ETL_CPP11_SUPPORTED #undef ETL_CPP14_SUPPORTED #undef ETL_CPP17_SUPPORTED @@ -46,8 +53,15 @@ SOFTWARE. #undef ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED #undef ETL_ATOMIC_SUPPORTED +// Determine the bit width of the platform. +#define ETL_PLATFORM_16BIT (UINT16_MAX == UINTPTR_MAX) +#define ETL_PLATFORM_32BIT (UINT32_MAX == UINTPTR_MAX) +#define ETL_PLATFORM_64BIT (UINT64_MAX == UINTPTR_MAX) + #include "etl_profile.h" +// The macros below are dependent on the profile. + #if defined(ETL_COMPILER_MICROSOFT) // Disable warning of deprecated std::iterator. #pragma warning(disable : 4996) diff --git a/include/etl/version.h b/include/etl/version.h index 70f29896..39688450 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -37,10 +37,10 @@ SOFTWARE. /// Definitions of the ETL version ///\ingroup utilities -#define ETL_VERSION "10.21.2" -#define ETL_VERSION_MAJOR 10 -#define ETL_VERSION_MINOR 21 -#define ETL_VERSION_PATCH 2 +#define ETL_VERSION "11.3.0" +#define ETL_VERSION_MAJOR 11 +#define ETL_VERSION_MINOR 3 +#define ETL_VERSION_PATCH 0 #endif diff --git a/support/Release notes.txt b/support/Release notes.txt index 3d56ce4e..5e074323 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +=============================================================================== +11.3.0 +Improved compatibility with 64 bit pltforms. + =============================================================================== 11.2.0 Added std::initializer_list constructors to containers, if ETL_CPP11_SUPPORTED is set to 1 diff --git a/test/codeblocks/ETL.cbp b/test/codeblocks/ETL.cbp index a399f5d1..994dbbe8 100644 --- a/test/codeblocks/ETL.cbp +++ b/test/codeblocks/ETL.cbp @@ -40,6 +40,25 @@ + + @@ -278,9 +297,11 @@ diff --git a/test/test_array_wrapper.cpp b/test/test_array_wrapper.cpp index b4eafaaf..c084f72c 100644 --- a/test/test_array_wrapper.cpp +++ b/test/test_array_wrapper.cpp @@ -557,7 +557,11 @@ namespace { Data5 aw5; size_t hash = etl::hash()(aw5); - size_t compare_hash = etl::fnv_1a_32(reinterpret_cast(&data5[0]), reinterpret_cast(&data5[5])); + + + size_t compare_hash = etl::__private_hash__::generic_hash(reinterpret_cast(&data5[0]), reinterpret_cast(&data5[5])); + + CHECK_EQUAL(compare_hash, hash); } }; diff --git a/test/test_hash.cpp b/test/test_hash.cpp index 3bac42dc..c9fbc425 100644 --- a/test/test_hash.cpp +++ b/test/test_hash.cpp @@ -126,10 +126,15 @@ namespace { size_t hash = etl::hash()((long long)(0x5AA555AA3CC333CC)); - if (sizeof(size_t) == sizeof(long long)) - CHECK_EQUAL(0x5AA555AA3CC333CCU, hash); - else + if (ETL_PLATFORM_32BIT) + { CHECK_EQUAL(0xEC6A8D69U, hash); + } + + if (ETL_PLATFORM_64BIT) + { + CHECK_EQUAL(0x5AA555AA3CC333CCU, hash); + } } //************************************************************************* @@ -137,10 +142,15 @@ namespace { size_t hash = etl::hash()((unsigned long long)(0x5AA555AA3CC333CC)); - if (sizeof(size_t) == sizeof(unsigned long long)) - CHECK_EQUAL(0x5AA555AA3CC333CCU, hash); - else + if (ETL_PLATFORM_32BIT) + { CHECK_EQUAL(0xEC6A8D69U, hash); + } + + if (ETL_PLATFORM_64BIT) + { + CHECK_EQUAL(0x5AA555AA3CC333CCU, hash); + } } //************************************************************************* @@ -148,18 +158,31 @@ namespace { size_t hash = etl::hash()((float)(1.2345)); - CHECK_EQUAL(0X3F9E0419U, hash); + if (ETL_PLATFORM_32BIT) + { + CHECK_EQUAL(0X3F9E0419U, hash); + } + + if (ETL_PLATFORM_64BIT) + { + CHECK_EQUAL(9821047038287739023U, hash); + } } //************************************************************************* TEST(test_hash_double) { size_t hash = etl::hash()((double)(1.2345)); - - if (sizeof(size_t) == sizeof(double)) - CHECK_EQUAL(0X3FF3C083126E978DU, hash); - else + + if (ETL_PLATFORM_32BIT) + { CHECK_EQUAL(0x86FBF224U, hash); + } + + if (ETL_PLATFORM_64BIT) + { + CHECK_EQUAL(0x3FF3C083126E978DU, hash); + } } //************************************************************************* diff --git a/test/test_pool.cpp b/test/test_pool.cpp index 57c5363c..8f14c5f2 100644 --- a/test/test_pool.cpp +++ b/test/test_pool.cpp @@ -383,11 +383,17 @@ namespace //************************************************************************* TEST(test_type_error) { + struct Test + { + uint64_t a; + uint64_t b; + }; + etl::pool pool; etl::ipool& ip = pool; - CHECK_THROW(ip.allocate(), etl::pool_element_size); + CHECK_THROW(ip.allocate(), etl::pool_element_size); } //************************************************************************* diff --git a/test/test_string_char.cpp b/test/test_string_char.cpp index d93d6d4d..bcf1f356 100644 --- a/test/test_string_char.cpp +++ b/test/test_string_char.cpp @@ -3032,7 +3032,7 @@ namespace // Test with actual string type. Text text(STR("ABCDEFHIJKL")); size_t hash = etl::hash()(text); - size_t compare_hash = etl::fnv_1a_32(reinterpret_cast(&text[0]), reinterpret_cast(&text[text.size()])); + size_t compare_hash = etl::__private_hash__::generic_hash(reinterpret_cast(&text[0]), reinterpret_cast(&text[text.size()])); CHECK_EQUAL(compare_hash, hash); // Test with interface string type. diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index aeff4cc2..0d1a2e5d 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -3031,7 +3031,7 @@ namespace // Test with actual string type. Text text(STR("ABCDEFHIJKL")); size_t hash = etl::hash()(text); - size_t compare_hash = etl::fnv_1a_32(reinterpret_cast(&text[0]), reinterpret_cast(&text[text.size()])); + size_t compare_hash = etl::__private_hash__::generic_hash(reinterpret_cast(&text[0]), reinterpret_cast(&text[text.size()])); CHECK_EQUAL(compare_hash, hash); // Test with interface string type. diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index 03d0912f..eb4db72f 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -3031,7 +3031,7 @@ namespace // Test with actual string type. Text text(STR("ABCDEFHIJKL")); size_t hash = etl::hash()(text); - size_t compare_hash = etl::fnv_1a_32(reinterpret_cast(&text[0]), reinterpret_cast(&text[text.size()])); + size_t compare_hash = etl::__private_hash__::generic_hash(reinterpret_cast(&text[0]), reinterpret_cast(&text[text.size()])); CHECK_EQUAL(compare_hash, hash); // Test with interface string type. diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index 1ae194aa..47e8ce9f 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -3031,7 +3031,7 @@ namespace // Test with actual string type. Text text(STR("ABCDEFHIJKL")); size_t hash = etl::hash()(text); - size_t compare_hash = etl::fnv_1a_32(reinterpret_cast(&text[0]), reinterpret_cast(&text[text.size()])); + size_t compare_hash = etl::__private_hash__::generic_hash(reinterpret_cast(&text[0]), reinterpret_cast(&text[text.size()])); CHECK_EQUAL(compare_hash, hash); // Test with interface string type. diff --git a/test/test_vector.cpp b/test/test_vector.cpp index e581faf0..9b753a15 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -495,12 +495,12 @@ namespace Compare_Data compare_data; Data data; - for (size_t i = 0; i < SIZE; ++i) + for (int i = 0; i < int(SIZE); ++i) { compare_data.push_back(i); } - for (size_t i = 0; i < SIZE; ++i) + for (int i = 0; i < int(SIZE); ++i) { data.push_back(i); } @@ -539,7 +539,7 @@ namespace { Data data; - for (size_t i = 0; i < SIZE; ++i) + for (int i = 0; i < int(SIZE); ++i) { data.push_back(i); } diff --git a/test/vs2017/etl.sln b/test/vs2017/etl.sln index 7c839529..553eb8ef 100644 --- a/test/vs2017/etl.sln +++ b/test/vs2017/etl.sln @@ -7,19 +7,37 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "etl", "etl.vcxproj", "{C21D EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug 64|Win32 = Debug 64|Win32 + Debug 64|x64 = Debug 64|x64 Debug No Unit Tests|Win32 = Debug No Unit Tests|Win32 + Debug No Unit Tests|x64 = Debug No Unit Tests|x64 Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug 64|Win32.ActiveCfg = Debug No Unit Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug 64|Win32.Build.0 = Debug No Unit Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug 64|x64.ActiveCfg = Debug64|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug 64|x64.Build.0 = Debug64|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No Unit Tests|Win32.ActiveCfg = Debug No Unit Tests|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No Unit Tests|Win32.Build.0 = Debug No Unit Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No Unit Tests|x64.ActiveCfg = Debug No Unit Tests|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No Unit Tests|x64.Build.0 = Debug No Unit Tests|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug|Win32.ActiveCfg = Debug|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug|Win32.Build.0 = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug|x64.ActiveCfg = Debug|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug|x64.Build.0 = Debug|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Release|Win32.ActiveCfg = Release|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Release|Win32.Build.0 = Release|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Release|x64.ActiveCfg = Release|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0E35F961-E9EF-40C4-8E3E-2EC79B1D44B8} + EndGlobalSection EndGlobal diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index efc88c3b..a7df379f 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -1,18 +1,38 @@  + + Debug64 + Win32 + + + Debug64 + x64 + Debug No Unit Tests Win32 + + Debug No Unit Tests + x64 + Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB} @@ -28,12 +48,36 @@ v141 Unicode + + Application + true + v141 + Unicode + + + Application + true + v141 + Unicode + + + Application + true + v141 + Unicode + Application true v141 Unicode + + Application + true + v141 + Unicode + Application false @@ -41,32 +85,75 @@ true Unicode + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + true true \$(IntDir) + + true + true + + + true + true + \$(IntDir) + + + true + true + true true + + true + true + false true + + false + true + @@ -88,7 +175,90 @@ $(OutDir)\etl.exe + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test + + + + + Console + true + + + + + + + @@ -130,6 +300,28 @@ $(OutDir)\etl.exe + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../src + false + + + Console + true + true + true + + + $(OutDir)\etl.exe + + @@ -341,7 +533,9 @@ ../../../unittest-cpp + ../../../unittest-cpp false + false @@ -360,8 +554,13 @@ false + false false + false + false + false false + false @@ -370,13 +569,19 @@ true + true true + true false + false + false + false false + false @@ -388,18 +593,33 @@ false + false + false + false false + false + false + false false + false + false + false false + false + false + false false + false + false + false @@ -408,11 +628,19 @@ false + false + false + false false + false true + true false + false + false + false @@ -425,7 +653,11 @@ false + false + false + false false + false @@ -436,6 +668,7 @@ true + true @@ -443,6 +676,7 @@ true + true