susumu.yata
null+****@clear*****
Mon Jan 5 16:46:03 JST 2015
susumu.yata 2015-01-05 16:46:03 +0900 (Mon, 05 Jan 2015) New Revision: 6f663f2447afe60109cc6de611703bd0fbafaae3 https://github.com/groonga/grnxx/commit/6f663f2447afe60109cc6de611703bd0fbafaae3 Message: Add Int::hash(). (#132) Modified files: include/grnxx/data_types/scalar/int.hpp Modified: include/grnxx/data_types/scalar/int.hpp (+10 -0) =================================================================== --- include/grnxx/data_types/scalar/int.hpp 2014-12-26 18:11:19 +0900 (4056b56) +++ include/grnxx/data_types/scalar/int.hpp 2015-01-05 16:46:03 +0900 (6cfe505) @@ -38,6 +38,16 @@ class Int { return raw_ == raw_na(); } + uint64_t hash() const { + uint64_t x = raw_; + x ^= x >> 33; + x *= uint64_t(0xFF51AFD7ED558CCDULL); + x ^= x >> 33; + x *= uint64_t(0xC4CEB9FE1A85EC53ULL); + x ^= x >> 33; + return x; + } + // -- Unary operators -- constexpr Int operator+() const { -------------- next part -------------- HTML����������������������������... Download