From 4e88652fa14d9fd8768a8c38ff2269368bd56e95 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 27 May 2017 18:16:27 +0300 Subject: [PATCH] [AIX] Added missing byteswap.h --- projects/Win/vc14/cds.sln | 2 ++ projects/Win/vc141/cds.sln | 1 + test/CMakeLists.txt | 14 +++++++++ test/include/cds_test/ext_byteswap.h | 45 ++++++++++++++++++++++++++++ test/stress/framework/city.cpp | 2 +- 5 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 test/include/cds_test/ext_byteswap.h diff --git a/projects/Win/vc14/cds.sln b/projects/Win/vc14/cds.sln index 06367d47..0fe447d5 100644 --- a/projects/Win/vc14/cds.sln +++ b/projects/Win/vc14/cds.sln @@ -18,6 +18,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cds_test", "cds_test", "{3A ProjectSection(SolutionItems) = preProject ..\..\..\test\include\cds_test\check_size.h = ..\..\..\test\include\cds_test\check_size.h ..\..\..\test\include\cds_test\city.h = ..\..\..\test\include\cds_test\city.h + ..\..\..\test\include\cds_test\ext_byteswap.h = ..\..\..\test\include\cds_test\ext_byteswap.h + ..\..\..\test\include\cds_test\ext_gtest.h = ..\..\..\test\include\cds_test\ext_gtest.h ..\..\..\test\include\cds_test\fc_hevy_value.h = ..\..\..\test\include\cds_test\fc_hevy_value.h ..\..\..\test\include\cds_test\fixture.h = ..\..\..\test\include\cds_test\fixture.h ..\..\..\test\include\cds_test\hash_func.h = ..\..\..\test\include\cds_test\hash_func.h diff --git a/projects/Win/vc141/cds.sln b/projects/Win/vc141/cds.sln index cb9297c8..2f7694cc 100644 --- a/projects/Win/vc141/cds.sln +++ b/projects/Win/vc141/cds.sln @@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cds_test", "cds_test", "{3A ProjectSection(SolutionItems) = preProject ..\..\..\test\include\cds_test\check_size.h = ..\..\..\test\include\cds_test\check_size.h ..\..\..\test\include\cds_test\city.h = ..\..\..\test\include\cds_test\city.h + ..\..\..\test\include\cds_test\ext_byteswap.h = ..\..\..\test\include\cds_test\ext_byteswap.h ..\..\..\test\include\cds_test\ext_gtest.h = ..\..\..\test\include\cds_test\ext_gtest.h ..\..\..\test\include\cds_test\fc_hevy_value.h = ..\..\..\test\include\cds_test\fc_hevy_value.h ..\..\..\test\include\cds_test\fixture.h = ..\..\..\test\include\cds_test\fixture.h diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 58925818..62f2419b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -67,6 +67,20 @@ set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES}) if(GTEST_INSTANTIATE_TEST_CASE_P_HAS_4TH_ARG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_LANG_CXX11 -DCDSTEST_GTEST_INSTANTIATE_TEST_CASE_P_HAS_4TH_ARG") endif() + +# Check if there is byteswap.h (needed for cityhash) +CHECK_CXX_SOURCE_COMPILES(" +#include +int main( int argc, char **argv ) +{ + return 0; +} +" CDSTEST_HAVE_BYTESWAP_H ) + +if(CDSTEST_HAVE_BYTESWAP_H) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCDSTEST_HAVE_BYTESWAP_H") +endif() + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stress) diff --git a/test/include/cds_test/ext_byteswap.h b/test/include/cds_test/ext_byteswap.h new file mode 100644 index 00000000..14628f92 --- /dev/null +++ b/test/include/cds_test/ext_byteswap.h @@ -0,0 +1,45 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSTEST_BYTESWAP_H +#define CDSTEST_BYTESWAP_H + +#ifdef CDSTEST_HAVE_BYTESWAP_H +# include +#else + +#define bswap_16(value) ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) << 32) | (uint64_t)bswap_32((uint32_t)((value) >> 32))) + +#endif +#endif // CDSTEST_BYTESWAP_H \ No newline at end of file diff --git a/test/stress/framework/city.cpp b/test/stress/framework/city.cpp index 26c53cbe..1d995578 100644 --- a/test/stress/framework/city.cpp +++ b/test/stress/framework/city.cpp @@ -72,7 +72,7 @@ static uint32 UNALIGNED_LOAD32(const char *p) { #else -#include +#include #endif -- 2.34.1