From: khizmax Date: Fri, 25 Sep 2015 21:03:18 +0000 (+0300) Subject: Fixed: CityHash is supported only in 64bit mode X-Git-Tag: v2.1.0~98 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3540d4d4a1b585faf51dc03666d4bac839cf6d9f;p=libcds.git Fixed: CityHash is supported only in 64bit mode --- diff --git a/tests/hashing/city.cpp b/tests/hashing/city.cpp index cbc5fc3a..69ba0e6a 100644 --- a/tests/hashing/city.cpp +++ b/tests/hashing/city.cpp @@ -29,6 +29,7 @@ //#include "config.h" #include "city.h" +#if CDS_BUILD_BITS == 64 #include #include // for memcpy and memset @@ -626,3 +627,4 @@ uint128 CityHashCrc128(const char *s, size_t len) { } #endif +#endif // #if CDS_BUILD_BITS == 64 diff --git a/tests/hashing/city.h b/tests/hashing/city.h index 94499ce4..5987470e 100644 --- a/tests/hashing/city.h +++ b/tests/hashing/city.h @@ -62,6 +62,9 @@ #ifndef CITY_HASH_H_ #define CITY_HASH_H_ +#include +#if CDS_BUILD_BITS == 64 + #include // for size_t. #include #include @@ -109,4 +112,5 @@ inline uint64 Hash128to64(const uint128& x) { return b; } +#endif // #if CDS_BUILD_BITS == 64 #endif // CITY_HASH_H_ diff --git a/tests/hashing/hash_func.h b/tests/hashing/hash_func.h index 4acdeff8..8dd23aba 100644 --- a/tests/hashing/hash_func.h +++ b/tests/hashing/hash_func.h @@ -3,9 +3,13 @@ #ifndef CDSUNIT_HASH_FUNC_H #define CDSUNIT_HASH_FUNC_H +#include + #include "hashing/sha256.h" #include "hashing/md5.h" -#include "hashing/city.h" +#if CDS_BUILD_BITS == 64 +# include "hashing/city.h" +#endif namespace hashing { @@ -42,6 +46,7 @@ namespace hashing { typedef hasher sha256; typedef hasher md5; +#if CDS_BUILD_BITS == 64 class city32 { public: typedef uint32_t hash_type; @@ -130,6 +135,8 @@ namespace hashing { } }; }; +#endif // #if CDS_BUILD_BITS == 64 + } // namespace hashing diff --git a/tests/unit/map2/map_defs.h b/tests/unit/map2/map_defs.h index bac6d3f3..64eb8603 100644 --- a/tests/unit/map2/map_defs.h +++ b/tests/unit/map2/map_defs.h @@ -729,6 +729,21 @@ // ************************************************************************************** // MultiLevelHashMap +#undef CDSUNIT_DECLARE_MultiLevelHashMap64 +#if CDS_BUILD_BITS == 64 +# define CDSUNIT_DECLARE_MultiLevelHashMap64 \ + TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city64) \ + TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city64_stat) \ + TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city64) \ + TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city64_stat) \ + TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city128) \ + TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city128_stat) \ + TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city128) \ + TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city128_stat) +#else +# define CDSUNIT_DECLARE_MultiLevelHashMap64 +#endif + #undef CDSUNIT_DECLARE_MultiLevelHashMap #define CDSUNIT_DECLARE_MultiLevelHashMap \ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_stdhash) \ @@ -743,15 +758,23 @@ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_sha256_stat) \ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_sha256) \ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_sha256_stat) \ - TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city64) \ - TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city64_stat) \ - TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city64) \ - TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city64_stat) \ - TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city128) \ - TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city128_stat) \ - TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city128) \ - TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city128_stat) \ - + CDSUNIT_DECLARE_MultiLevelHashMap64 + + +#undef CDSUNIT_TEST_MultiLevelHashMap64 +#if CDS_BUILD_BITS == 64 +# define CDSUNIT_TEST_MultiLevelHashMap64 \ + CPPUNIT_TEST(MultiLevelHashMap_hp_city64) \ + CPPUNIT_TEST(MultiLevelHashMap_hp_city64_stat) \ + CPPUNIT_TEST(MultiLevelHashMap_dhp_city64) \ + CPPUNIT_TEST(MultiLevelHashMap_dhp_city64_stat) \ + CPPUNIT_TEST(MultiLevelHashMap_hp_city128) \ + CPPUNIT_TEST(MultiLevelHashMap_hp_city128_stat) \ + CPPUNIT_TEST(MultiLevelHashMap_dhp_city128) \ + CPPUNIT_TEST(MultiLevelHashMap_dhp_city128_stat) +#else +# define CDSUNIT_TEST_MultiLevelHashMap64 +#endif #undef CDSUNIT_TEST_MultiLevelHashMap #define CDSUNIT_TEST_MultiLevelHashMap \ @@ -767,12 +790,5 @@ CPPUNIT_TEST(MultiLevelHashMap_hp_sha256_stat) \ CPPUNIT_TEST(MultiLevelHashMap_dhp_sha256) \ CPPUNIT_TEST(MultiLevelHashMap_dhp_sha256_stat) \ - CPPUNIT_TEST(MultiLevelHashMap_hp_city64) \ - CPPUNIT_TEST(MultiLevelHashMap_hp_city64_stat) \ - CPPUNIT_TEST(MultiLevelHashMap_dhp_city64) \ - CPPUNIT_TEST(MultiLevelHashMap_dhp_city64_stat) \ - CPPUNIT_TEST(MultiLevelHashMap_hp_city128) \ - CPPUNIT_TEST(MultiLevelHashMap_hp_city128_stat) \ - CPPUNIT_TEST(MultiLevelHashMap_dhp_city128) \ - CPPUNIT_TEST(MultiLevelHashMap_dhp_city128_stat) \ + CDSUNIT_TEST_MultiLevelHashMap64 diff --git a/tests/unit/map2/map_type_multilevel_hashmap.h b/tests/unit/map2/map_type_multilevel_hashmap.h index 4dc547a1..623cfbc8 100644 --- a/tests/unit/map2/map_type_multilevel_hashmap.h +++ b/tests/unit/map2/map_type_multilevel_hashmap.h @@ -79,6 +79,7 @@ namespace map2 { typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_md5_stat > MultiLevelHashMap_dhp_md5_stat; // CityHash +#if CDS_BUILD_BITS == 64 struct traits_MultiLevelHashMap_city64 : public cc::multilevel_hashmap::traits { typedef ::hashing::city64 hash; @@ -108,7 +109,7 @@ namespace map2 { }; typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_hp_city128_stat; typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_dhp_city128_stat; - +#endif // CDS_BUILD_BITS == 64 }; template diff --git a/tests/unit/set2/set_defs.h b/tests/unit/set2/set_defs.h index be2bcf02..6933407d 100644 --- a/tests/unit/set2/set_defs.h +++ b/tests/unit/set2/set_defs.h @@ -618,6 +618,21 @@ //*********************************************** // MultiLevelHashSet +#undef CDSUNIT_DECLARE_MultiLevelHashSet64 +#if CDS_BUILD_BITS == 64 +# define CDSUNIT_DECLARE_MultiLevelHashSet64 \ + TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_city64) \ + TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_city64_stat) \ + TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_city64) \ + TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_city64_stat) \ + TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_city128) \ + TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_city128_stat) \ + TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_city128) \ + TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_city128_stat) +#else +# define CDSUNIT_DECLARE_MultiLevelHashSet64 +#endif + #undef CDSUNIT_DECLARE_MultiLevelHashSet #define CDSUNIT_DECLARE_MultiLevelHashSet \ TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_stdhash) \ @@ -632,15 +647,22 @@ TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_sha256_stat) \ TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_sha256) \ TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_sha256_stat) \ - TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_city64) \ - TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_city64_stat) \ - TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_city64) \ - TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_city64_stat) \ - TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_city128) \ - TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_hp_city128_stat) \ - TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_city128) \ - TEST_CASE(tag_MultiLevelHashSet, MultiLevelHashSet_dhp_city128_stat) + CDSUNIT_DECLARE_MultiLevelHashSet64 +#undef CDSUNIT_TEST_MultiLevelHashSet64 +#if CDS_BUILD_BITS == 64 +# define CDSUNIT_TEST_MultiLevelHashSet64 \ + CPPUNIT_TEST(MultiLevelHashSet_hp_city64) \ + CPPUNIT_TEST(MultiLevelHashSet_hp_city64_stat) \ + CPPUNIT_TEST(MultiLevelHashSet_dhp_city64) \ + CPPUNIT_TEST(MultiLevelHashSet_dhp_city64_stat) \ + CPPUNIT_TEST(MultiLevelHashSet_hp_city128) \ + CPPUNIT_TEST(MultiLevelHashSet_hp_city128_stat) \ + CPPUNIT_TEST(MultiLevelHashSet_dhp_city128) \ + CPPUNIT_TEST(MultiLevelHashSet_dhp_city128_stat) +#else +# define CDSUNIT_TEST_MultiLevelHashSet64 +#endif #undef CDSUNIT_TEST_MultiLevelHashSet #define CDSUNIT_TEST_MultiLevelHashSet \ @@ -656,12 +678,4 @@ CPPUNIT_TEST(MultiLevelHashSet_hp_sha256_stat) \ CPPUNIT_TEST(MultiLevelHashSet_dhp_sha256) \ CPPUNIT_TEST(MultiLevelHashSet_dhp_sha256_stat) \ - CPPUNIT_TEST(MultiLevelHashSet_hp_city64) \ - CPPUNIT_TEST(MultiLevelHashSet_hp_city64_stat) \ - CPPUNIT_TEST(MultiLevelHashSet_dhp_city64) \ - CPPUNIT_TEST(MultiLevelHashSet_dhp_city64_stat) \ - CPPUNIT_TEST(MultiLevelHashSet_hp_city128) \ - CPPUNIT_TEST(MultiLevelHashSet_hp_city128_stat) \ - CPPUNIT_TEST(MultiLevelHashSet_dhp_city128) \ - CPPUNIT_TEST(MultiLevelHashSet_dhp_city128_stat) - + CDSUNIT_TEST_MultiLevelHashSet64 diff --git a/tests/unit/set2/set_type_multilevel_hashset.h b/tests/unit/set2/set_type_multilevel_hashset.h index c022d5de..46941016 100644 --- a/tests/unit/set2/set_type_multilevel_hashset.h +++ b/tests/unit/set2/set_type_multilevel_hashset.h @@ -144,6 +144,7 @@ namespace set2 { typedef MultiLevelHashSet< cds::gc::DHP, key_val<::hashing::md5>, traits_MultiLevelHashSet_md5_stat > MultiLevelHashSet_dhp_md5_stat; // CityHash +#if CDS_BUILD_BITS == 64 struct traits_MultiLevelHashSet_city64 : public default_traits { typedef ::hashing::city64::less less; @@ -171,6 +172,7 @@ namespace set2 { }; typedef MultiLevelHashSet< cds::gc::HP, key_val<::hashing::city128>, traits_MultiLevelHashSet_city128_stat > MultiLevelHashSet_hp_city128_stat; typedef MultiLevelHashSet< cds::gc::DHP, key_val<::hashing::city128>, traits_MultiLevelHashSet_city128_stat > MultiLevelHashSet_dhp_city128_stat; +#endif // #if CDS_BUILD_BITS == 64 }; template