From 7592b908b684b84bc20ec0cfa2d5d97e16aead7b Mon Sep 17 00:00:00 2001 From: graehl Date: Wed, 11 Aug 2010 02:48:00 +0000 Subject: merge git-svn-id: https://ws10smt.googlecode.com/svn/trunk@512 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/hash.h | 54 ------------------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100755 decoder/hash.h (limited to 'decoder/hash.h') diff --git a/decoder/hash.h b/decoder/hash.h deleted file mode 100755 index 3a60a429..00000000 --- a/decoder/hash.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef CDEC_HASH_H -#define CDEC_HASH_H - -#include "murmur_hash.h" - -#include "config.h" -#ifdef HAVE_SPARSEHASH -# include -# define HASH_MAP google::dense_hash_map -# define HASH_MAP_RESERVED(h,empty,deleted) do { h.set_empty_key(empty); h.set_deleted_key(deleted); } while(0) -# define HASH_MAP_EMPTY(h,empty) do { h.set_empty_key(empty); } while(0) -#else -# include -# define HASH_MAP std::tr1::unordered_map -# define HASH_MAP_RESERVED(h,empty,deleted) -# define HASH_MAP_EMPTY(h,empty) -#endif - -#include - -// assumes C is POD -template -struct murmur_hash -{ - typedef MurmurInt return_type; - typedef C /*const&*/ argument_type; - return_type operator()(argument_type const& c) const { - return MurmurHash((void*)&c,sizeof(c)); - } -}; - -// murmur_hash_array isn't std guaranteed safe (you need to use string::data()) -template <> -struct murmur_hash -{ - typedef MurmurInt return_type; - typedef std::string /*const&*/ argument_type; - return_type operator()(argument_type const& c) const { - return MurmurHash(c.data(),c.size()); - } -}; - -// uses begin(),size() assuming contiguous layout and POD -template -struct murmur_hash_array -{ - typedef MurmurInt return_type; - typedef C /*const&*/ argument_type; - return_type operator()(argument_type const& c) const { - return MurmurHash(&*c.begin(),c.size()*sizeof(*c.begin())); - } -}; - -#endif -- cgit v1.2.3