Merge pull request #6390 from yandex/fix-build-on-mac-default-hash-uintptr_t

Fix for Mac OS build
This commit is contained in:
alexey-milovidov 2019-08-08 04:43:05 +03:00 committed by GitHub
commit 235cf98710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
#include <Core/Types.h> #include <Core/Types.h>
#include <Common/UInt128.h> #include <Common/UInt128.h>
#include <type_traits>
/** Hash functions that are better than the trivial function std::hash. /** Hash functions that are better than the trivial function std::hash.
* *
@ -57,8 +59,6 @@ inline DB::UInt64 intHashCRC32(DB::UInt64 x)
} }
template <typename T> struct DefaultHash;
template <typename T> template <typename T>
inline size_t DefaultHash64(T key) inline size_t DefaultHash64(T key)
{ {
@ -72,28 +72,18 @@ inline size_t DefaultHash64(T key)
return intHash64(u.out); return intHash64(u.out);
} }
#define DEFINE_HASH(T) \ template <typename T, typename Enable = void>
template <> struct DefaultHash<T>\ struct DefaultHash;
{\
size_t operator() (T key) const\ template <typename T>
{\ struct DefaultHash<T, std::enable_if_t<std::is_arithmetic_v<T>>>
return DefaultHash64<T>(key);\ {
}\ size_t operator() (T key) const
{
return DefaultHash64<T>(key);
}
}; };
DEFINE_HASH(DB::UInt8)
DEFINE_HASH(DB::UInt16)
DEFINE_HASH(DB::UInt32)
DEFINE_HASH(DB::UInt64)
DEFINE_HASH(DB::Int8)
DEFINE_HASH(DB::Int16)
DEFINE_HASH(DB::Int32)
DEFINE_HASH(DB::Int64)
DEFINE_HASH(DB::Float32)
DEFINE_HASH(DB::Float64)
#undef DEFINE_HASH
template <typename T> struct HashCRC32; template <typename T> struct HashCRC32;