Skip to content
Browse files

Merge branch 'uuid_hash_fix'

  • Loading branch information...
2 parents 1c4c5c1 + dae5cec commit 707631465c83db2c3e6c7764d1ad9e03070efcd0 @iconara committed Mar 7, 2014
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/cql/uuid.rb
  2. +1 −1 spec/cql/uuid_spec.rb
View
2 lib/cql/uuid.rb
@@ -39,7 +39,7 @@ def to_s
end
def hash
- @h = (@n & 0xffffffffffffffff) ^ ((@n >> 64) & 0xffffffffffffffff)
+ @h ||= 0x7fffffffffffffff - ((@n & 0xffffffffffffffff) ^ ((@n >> 64) & 0xffffffffffffffff))
end
# Returns the numerical representation of this UUID
View
2 spec/cql/uuid_spec.rb
@@ -60,7 +60,7 @@ module Cql
describe '#hash' do
it 'calculates a 64 bit hash of the UUID' do
- h = Uuid.new(276263553384940695775376958868900023510).hash
+ h = Uuid.new(162917432198567078063626261009205865234).hash
h.should be < 2**63
h.should be > -2**63
end

0 comments on commit 7076314

Please sign in to comment.
Something went wrong with that request. Please try again.