]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/hash.cpp
Add move semantics to Variant
[libs/core.git] / source / core / hash.cpp
diff --git a/source/core/hash.cpp b/source/core/hash.cpp
deleted file mode 100644 (file)
index fe5e339..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <stdexcept>
-#include "hash.h"
-
-using namespace std;
-
-namespace Msp {
-
-/*
-http://en.wikipedia.org/wiki/Fowler-Noll-Vo_hash_function
-http://www.isthe.com/chongo/tech/comp/fnv/index.html
-*/
-
-UInt32 hash32(const void *data, unsigned size, unsigned bits)
-{
-       if(bits==0 || bits>32)
-               throw invalid_argument("hash32");
-
-       static const unsigned prime = 16777619;
-       static const unsigned offset = 2166136261U;
-
-       unsigned result = offset;
-       for(unsigned i=0; i<size; ++i)
-               result = (result^*(reinterpret_cast<const unsigned char *>(data)+i))*prime;
-
-       if(bits<32)
-               result = (result>>bits ^ result) & ((1<<bits)-1);
-
-       return result;
-}
-
-UInt64 hash64(const void *data, unsigned size, unsigned bits)
-{
-       if(bits==0 || bits>64)
-               throw invalid_argument("hash64");
-
-       static const UInt64 prime = 1099511628211ULL;
-       static const UInt64 offset = 14695981039346656037ULL;
-
-       UInt64 result = offset;
-       for(unsigned i=0; i<size; ++i)
-               result = (result^*(reinterpret_cast<const unsigned char *>(data)+i))*prime;
-
-       if(bits<64)
-               result = (result>>bits ^ result) & ((1ULL<<bits)-1);
-
-       return result;
-}
-
-} // namespace Msp