Fixed: CityHash is supported only in 64bit mode
authorkhizmax <libcds.dev@gmail.com>
Fri, 25 Sep 2015 21:03:18 +0000 (00:03 +0300)
committerkhizmax <libcds.dev@gmail.com>
Fri, 25 Sep 2015 21:03:18 +0000 (00:03 +0300)
tests/hashing/city.cpp
tests/hashing/city.h
tests/hashing/hash_func.h
tests/unit/map2/map_defs.h
tests/unit/map2/map_type_multilevel_hashmap.h
tests/unit/set2/set_defs.h
tests/unit/set2/set_type_multilevel_hashset.h

index cbc5fc3ae62c4ed47587702f0c7a83cfecc4bd0e..69ba0e6a48ab07ad527d304bd3f06fba3d21adeb 100644 (file)
@@ -29,6 +29,7 @@
 
 //#include "config.h"
 #include "city.h"
+#if CDS_BUILD_BITS == 64
 
 #include <algorithm>
 #include <string.h>  // for memcpy and memset
@@ -626,3 +627,4 @@ uint128 CityHashCrc128(const char *s, size_t len) {
 }
 
 #endif
+#endif // #if CDS_BUILD_BITS == 64
index 94499ce419c798d60736cd83f1aa77d9b864a0bd..5987470e38e9a9caa4a3a704d5dbb991beddb62c 100644 (file)
@@ -62,6 +62,9 @@
 #ifndef CITY_HASH_H_
 #define CITY_HASH_H_
 
+#include <cds/details/defs.h>
+#if CDS_BUILD_BITS == 64
+
 #include <stdlib.h>  // for size_t.
 #include <stdint.h>
 #include <utility>
@@ -109,4 +112,5 @@ inline uint64 Hash128to64(const uint128& x) {
   return b;
 }
 
+#endif // #if CDS_BUILD_BITS == 64
 #endif  // CITY_HASH_H_
index 4acdeff86d7652e8c9f681cdbda450a70b0959f8..8dd23abab83c515d6fcd5f229c484dfc21fe74b8 100644 (file)
@@ -3,9 +3,13 @@
 #ifndef CDSUNIT_HASH_FUNC_H
 #define CDSUNIT_HASH_FUNC_H
 
+#include <cds/details/defs.h>
+
 #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> sha256;
     typedef hasher<MD5> 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
 
index bac6d3f3554353f9c7c45e73ebd5ca7a83b6df21..64eb8603bc948bda2de131b0dd38c3581739af91 100644 (file)
 // **************************************************************************************
 // 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) \
     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  \
     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
 
index 4dc547a116b76c0d5baf06fcb602fcad6456ed34..623cfbc893fcb81abd3c041a0a43c2b07d5d54e9 100644 (file)
@@ -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 <typename GC, typename K, typename T, typename Traits >
index be2bcf02086ff0fa15f9b3445ac37eea5f297228..6933407d0d5f642bd78d22a135d793db47729d0a 100644 (file)
 //***********************************************
 // 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) \
     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  \
     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
index c022d5de9068840188ea019f55376de6881ec5e0..46941016f8ed521ff5ac90bfd4a148d0fdcfbe6b 100644 (file)
@@ -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 <typename GC, typename T, typename Traits >