Navigation Menu

Skip to content

Commit

Permalink
Add Int::hash(). (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yata committed Jan 5, 2015
1 parent 21084df commit 6f663f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/grnxx/data_types/scalar/int.hpp
Expand Up @@ -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 {
Expand Down

0 comments on commit 6f663f2

Please sign in to comment.