Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor update (documentation)

  • Loading branch information...
commit 53b5337d09868a922e050bda0dcd6fadc5718c6c 1 parent dc8c1f9
@lemire authored
Showing with 21 additions and 4 deletions.
  1. +1 −1  README
  2. +20 −3 hashfunctions.h
View
2  README
@@ -5,7 +5,7 @@ Daniel Lemire, October 25, 2010
What is this?
--------------
-An implementation of a few very fast strongly universal hash functions
+An implementation of a few very fast almost universal hash functions
over 32-bit strings.
Usage
View
23 hashfunctions.h
@@ -38,7 +38,7 @@ class Silly {
/*
-* This is just like StrongMultilinear but with a bit of loop unrolling. Strongly universal.
+* This is just like StrongMultilinear but with a bit of loop unrolling. Almost universal.
* Assumes an even number of elements.
* Also assumes that the string does not exceed the size of the provided randombuffer (no checking).
*/
@@ -62,7 +62,7 @@ class StrongMultilinear {
};
/*
-* This is just like StrongMultilinear but with a bit of loop unrolling. Strongly universal.
+* This is just like StrongMultilinear but with a bit of loop unrolling. Almost universal.
* Assumes an even number of elements.
* Also assumes that the string does not exceed the size of the provided randombuffer (no checking).
*/
@@ -87,7 +87,7 @@ class StrongMultilinearTwoByTwo {
/*
-* From Thorup, SODA 09. Strongly universal.
+* From Thorup, SODA 09. Almost universal.
* Assumes an even number of elements.
* Also assumes that the string does not exceed the size of the provided randombuffer (no checking).
*/
@@ -110,6 +110,23 @@ class Thorup {
};
+// just for testing purposes
+class NoMultiplication {
+ public:
+ NoMultiplication(const vector<uint64> & randombuffer) : firstfew(randombuffer) {
+ }
+
+ template <class INTEGER>
+ uint32 hash(const INTEGER * p, const INTEGER * const endp) const {
+ const uint64 * randomdata = & firstfew[0];
+ uint64 sum = *(randomdata++);
+ for(;p!=endp;++p,++randomdata) {
+ sum+= (*p)^(*randomdata) ;//*randomdata + static_cast<uint64>(*p);
+ }
+ return static_cast<uint32>(sum>>32);
+ }
+ const vector<uint64> & firstfew;
+};
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.