You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2021/02/19 06:58:49 UTC

[datasketches-cpp] branch seed_hash_collision created (now 7537a63)

This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a change to branch seed_hash_collision
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git.


      at 7537a63  ensure compute_seed_hash uses a common definition to avoid conflicting definitions

This branch includes the following new commits:

     new 7537a63  ensure compute_seed_hash uses a common definition to avoid conflicting definitions

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[datasketches-cpp] 01/01: ensure compute_seed_hash uses a common definition to avoid conflicting definitions

Posted by jm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch seed_hash_collision
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git

commit 7537a632960d110a5fbb81ba0b372592551e446c
Author: Jon Malkin <jm...@users.noreply.github.com>
AuthorDate: Thu Feb 18 22:58:29 2021 -0800

    ensure compute_seed_hash uses a common definition to avoid conflicting definitions
---
 common/include/MurmurHash3.h               | 7 +++++++
 cpc/include/cpc_util.hpp                   | 6 ------
 theta/include/theta_update_sketch_base.hpp | 6 ------
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/common/include/MurmurHash3.h b/common/include/MurmurHash3.h
index b438c7d..c1cbeab 100644
--- a/common/include/MurmurHash3.h
+++ b/common/include/MurmurHash3.h
@@ -3,6 +3,7 @@
 //  * Changed input seed in MurmurHash3_x64_128 to uint64_t
 //  * Define and use HashState reference to return result
 //  * Made entire hash function defined inline
+//  * Added compute_seed_hash
 //-----------------------------------------------------------------------------
 // MurmurHash3 was written by Austin Appleby, and is placed in the public
 // domain. The author hereby disclaims copyright to this source code.
@@ -170,4 +171,10 @@ FORCE_INLINE void MurmurHash3_x64_128(const void* key, int lenBytes, uint64_t se
 
 //-----------------------------------------------------------------------------
 
+FORCE_INLINE uint16_t compute_seed_hash(uint64_t seed) {
+  HashState hashes;
+  MurmurHash3_x64_128(&seed, sizeof(seed), 0, hashes);
+  return static_cast<uint16_t>(hashes.h1 & 0xffff);
+}
+
 #endif // _MURMURHASH3_H_
diff --git a/cpc/include/cpc_util.hpp b/cpc/include/cpc_util.hpp
index b63f26f..1a33b3a 100644
--- a/cpc/include/cpc_util.hpp
+++ b/cpc/include/cpc_util.hpp
@@ -24,12 +24,6 @@
 
 namespace datasketches {
 
-static inline uint16_t compute_seed_hash(uint64_t seed) {
-  HashState hashes;
-  MurmurHash3_x64_128(&seed, sizeof(seed), 0, hashes);
-  return hashes.h1 & 0xffff;
-}
-
 static inline uint64_t divide_longs_rounding_up(uint64_t x, uint64_t y) {
   if (y == 0) throw std::invalid_argument("divide_longs_rounding_up: bad argument");
   const uint64_t quotient = x / y;
diff --git a/theta/include/theta_update_sketch_base.hpp b/theta/include/theta_update_sketch_base.hpp
index 337f68f..eae7984 100644
--- a/theta/include/theta_update_sketch_base.hpp
+++ b/theta/include/theta_update_sketch_base.hpp
@@ -185,12 +185,6 @@ static inline uint64_t compute_hash(const void* data, size_t length, uint64_t se
   return (hashes.h1 >> 1); // Java implementation does unsigned shift >>> to make values positive
 }
 
-static inline uint16_t compute_seed_hash(uint64_t seed) {
-  HashState hashes;
-  MurmurHash3_x64_128(&seed, sizeof(seed), 0, hashes);
-  return hashes.h1;
-}
-
 // iterators
 
 template<typename Entry, typename ExtractKey>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org