62 lines
1.5 KiB
Text
62 lines
1.5 KiB
Text
From 4e6f7b7799fa076b80aa5839655fef43f7c11a1f Mon Sep 17 00:00:00 2001
|
|
From: Jan Engelhardt <jengelh@inai.de>
|
|
Date: Wed, 11 Oct 2023 15:59:39 +0200
|
|
Subject: [PATCH] build: resolve compile/linkvalidation error related to
|
|
FNV::apply<T>
|
|
|
|
Index: exch/ews/hash.hpp
|
|
--- exch/ews/hash.hpp.orig
|
|
+++ exch/ews/hash.hpp
|
|
@@ -16,7 +16,27 @@
|
|
*/
|
|
struct FNV
|
|
{
|
|
+ private:
|
|
/**
|
|
+ * @brief Update hash
|
|
+ *
|
|
+ * @param data Data to hash
|
|
+ * @param count Data element count
|
|
+ *
|
|
+ * @tparam T One of uint8_t, uint16_t, uint32_t or uint64_t
|
|
+ *
|
|
+ * @return New hash value
|
|
+ */
|
|
+ template<typename T>
|
|
+ constexpr uint64_t apply(const T *data, uint64_t count) noexcept
|
|
+ {
|
|
+ for (const T *ptr = data; ptr < &data[count]; ++ptr)
|
|
+ value = (value ^ static_cast<uint64_t>(*ptr)) * 0x100000001b3ULL;
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ public:
|
|
+ /**
|
|
* @brief Initialize by consecutively hashing all objects
|
|
*
|
|
* @param objs Objects to hash
|
|
@@ -83,24 +103,4 @@ struct FNV
|
|
}
|
|
|
|
uint64_t value = 0xcbf29ce484222325ULL; ///< Current hash value
|
|
-
|
|
-private:
|
|
- /**
|
|
- * @brief Update hash
|
|
- *
|
|
- * @param data Data to hash
|
|
- * @param count Data element count
|
|
- *
|
|
- * @tparam T One of uint8_t, uint16_t, uint32_t or uint64_t
|
|
- *
|
|
- * @return New hash value
|
|
- */
|
|
- template<typename T>
|
|
- constexpr uint64_t apply(const T* data, uint64_t count) noexcept
|
|
- {
|
|
- for(const T* ptr = data; ptr < data+count; ++ptr)
|
|
- value = (value^uint64_t(*ptr))*0x100000001b3ULL;
|
|
- return value;
|
|
- }
|
|
};
|
|
-
|