diff --git a/parallel_hashmap/phmap.h b/parallel_hashmap/phmap.h index 13a057a..43bd6a6 100644 --- a/parallel_hashmap/phmap.h +++ b/parallel_hashmap/phmap.h @@ -400,7 +400,7 @@ inline ctrl_t* EmptyGroup() { // Mixes a randomly generated per-process seed with `hash` and `ctrl` to // randomize insertion order within groups. // -------------------------------------------------------------------------- -bool ShouldInsertBackwards(size_t hash, ctrl_t* ctrl); +static inline bool ShouldInsertBackwards(size_t hash, ctrl_t* ctrl); // -------------------------------------------------------------------------- // Returns a hash seed. @@ -450,7 +450,7 @@ inline __m128i _mm_cmpgt_epi8_fixed(__m128i a, __m128i b) { // -------------------------------------------------------------------------- struct GroupSse2Impl { - static constexpr size_t kWidth = 16; // the number of slots per group + enum { kWidth = 16 }; // the number of slots per group explicit GroupSse2Impl(const ctrl_t* pos) { ctrl = _mm_loadu_si128(reinterpret_cast(pos)); @@ -514,7 +514,7 @@ struct GroupSse2Impl // -------------------------------------------------------------------------- struct GroupPortableImpl { - static constexpr size_t kWidth = 8; + enum { kWidth = 8 }; explicit GroupPortableImpl(const ctrl_t* pos) : ctrl(little_endian::Load64(pos)) {} @@ -691,13 +691,13 @@ struct HashtablezInfo inline void RecordRehashSlow(HashtablezInfo* info, size_t total_probe_length) {} -void RecordInsertSlow(HashtablezInfo* info, size_t hash, - size_t distance_from_desired) {} +static inline void RecordInsertSlow(HashtablezInfo* info, size_t hash, + size_t distance_from_desired) {} -inline void RecordEraseSlow(HashtablezInfo* info) {} +static inline void RecordEraseSlow(HashtablezInfo* info) {} -HashtablezInfo* SampleSlow(int64_t* next_sample) { return nullptr; } -void UnsampleSlow(HashtablezInfo* info) {} +static inline HashtablezInfo* SampleSlow(int64_t* next_sample) { return nullptr; } +static inline void UnsampleSlow(HashtablezInfo* info) {} class HashtablezInfoHandle { @@ -710,7 +710,7 @@ public: HashtablezInfoHandle& rhs) {} }; -inline HashtablezInfoHandle Sample() { return HashtablezInfoHandle(); } +static inline HashtablezInfoHandle Sample() { return HashtablezInfoHandle(); } class HashtablezSampler { @@ -725,9 +725,9 @@ public: int64_t Iterate(const std::function& f) { return 0; } }; -void SetHashtablezEnabled(bool enabled) {} -void SetHashtablezSampleParameter(int32_t rate) {} -void SetHashtablezMaxSamples(int32_t max) {} +static inline void SetHashtablezEnabled(bool enabled) {} +static inline void SetHashtablezSampleParameter(int32_t rate) {} +static inline void SetHashtablezMaxSamples(int32_t max) {} namespace memory_internal { @@ -2447,8 +2447,6 @@ private: // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- -constexpr size_t Group::kWidth; - // Returns "random" seed. inline size_t RandomSeed() { @@ -2462,7 +2460,7 @@ inline size_t RandomSeed() return value ^ static_cast(reinterpret_cast(&counter)); } -bool ShouldInsertBackwards(size_t hash, ctrl_t* ctrl) +static inline bool ShouldInsertBackwards(size_t hash, ctrl_t* ctrl) { // To avoid problems with weak hashes and single bit tests, we use % 13. // TODO(kfm,sbenza): revisit after we do unconditional mixing diff --git a/parallel_hashmap/phmap_base.h b/parallel_hashmap/phmap_base.h index 3f38c4e..0a9f57e 100644 --- a/parallel_hashmap/phmap_base.h +++ b/parallel_hashmap/phmap_base.h @@ -779,71 +779,71 @@ template } } // namespace -void ThrowStdLogicError(const std::string& what_arg) { +static inline void ThrowStdLogicError(const std::string& what_arg) { Throw(std::logic_error(what_arg)); } -void ThrowStdLogicError(const char* what_arg) { +static inline void ThrowStdLogicError(const char* what_arg) { Throw(std::logic_error(what_arg)); } -void ThrowStdInvalidArgument(const std::string& what_arg) { +static inline void ThrowStdInvalidArgument(const std::string& what_arg) { Throw(std::invalid_argument(what_arg)); } -void ThrowStdInvalidArgument(const char* what_arg) { +static inline void ThrowStdInvalidArgument(const char* what_arg) { Throw(std::invalid_argument(what_arg)); } -void ThrowStdDomainError(const std::string& what_arg) { +static inline void ThrowStdDomainError(const std::string& what_arg) { Throw(std::domain_error(what_arg)); } -void ThrowStdDomainError(const char* what_arg) { +static inline void ThrowStdDomainError(const char* what_arg) { Throw(std::domain_error(what_arg)); } -void ThrowStdLengthError(const std::string& what_arg) { +static inline void ThrowStdLengthError(const std::string& what_arg) { Throw(std::length_error(what_arg)); } -void ThrowStdLengthError(const char* what_arg) { +static inline void ThrowStdLengthError(const char* what_arg) { Throw(std::length_error(what_arg)); } -void ThrowStdOutOfRange(const std::string& what_arg) { +static inline void ThrowStdOutOfRange(const std::string& what_arg) { Throw(std::out_of_range(what_arg)); } -void ThrowStdOutOfRange(const char* what_arg) { +static inline void ThrowStdOutOfRange(const char* what_arg) { Throw(std::out_of_range(what_arg)); } -void ThrowStdRuntimeError(const std::string& what_arg) { +static inline void ThrowStdRuntimeError(const std::string& what_arg) { Throw(std::runtime_error(what_arg)); } -void ThrowStdRuntimeError(const char* what_arg) { +static inline void ThrowStdRuntimeError(const char* what_arg) { Throw(std::runtime_error(what_arg)); } -void ThrowStdRangeError(const std::string& what_arg) { +static inline void ThrowStdRangeError(const std::string& what_arg) { Throw(std::range_error(what_arg)); } -void ThrowStdRangeError(const char* what_arg) { +static inline void ThrowStdRangeError(const char* what_arg) { Throw(std::range_error(what_arg)); } -void ThrowStdOverflowError(const std::string& what_arg) { +static inline void ThrowStdOverflowError(const std::string& what_arg) { Throw(std::overflow_error(what_arg)); } -void ThrowStdOverflowError(const char* what_arg) { +static inline void ThrowStdOverflowError(const char* what_arg) { Throw(std::overflow_error(what_arg)); } -void ThrowStdUnderflowError(const std::string& what_arg) { +static inline void ThrowStdUnderflowError(const std::string& what_arg) { Throw(std::underflow_error(what_arg)); } -void ThrowStdUnderflowError(const char* what_arg) { +static inline void ThrowStdUnderflowError(const char* what_arg) { Throw(std::underflow_error(what_arg)); } -void ThrowStdBadFunctionCall() { Throw(std::bad_function_call()); } +static inline void ThrowStdBadFunctionCall() { Throw(std::bad_function_call()); } -void ThrowStdBadAlloc() { Throw(std::bad_alloc()); } +static inline void ThrowStdBadAlloc() { Throw(std::bad_alloc()); } } // namespace base_internal } // namespace phmap diff --git a/parallel_hashmap/phmap_config.h b/parallel_hashmap/phmap_config.h index 9ab6dfe..00fec95 100644 --- a/parallel_hashmap/phmap_config.h +++ b/parallel_hashmap/phmap_config.h @@ -60,9 +60,9 @@ // ----------------------------------------------------------------------------- // Some sanity checks // ----------------------------------------------------------------------------- -#if defined(__CYGWIN__) - #error "Cygwin is not supported." -#endif +//#if defined(__CYGWIN__) +// #error "Cygwin is not supported." +//#endif #if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023918 && !defined(__clang__) #error "phmap requires Visual Studio 2015 Update 2 or higher."