Skip to content

Instantly share code, notes, and snippets.

@kronos
Created February 26, 2010 20:31
Show Gist options
  • Save kronos/316118 to your computer and use it in GitHub Desktop.
Save kronos/316118 to your computer and use it in GitHub Desktop.
diff --git a/kernel/common/array.rb b/kernel/common/array.rb
index 39bfde2..a66ac71 100644
--- a/kernel/common/array.rb
+++ b/kernel/common/array.rb
@@ -743,8 +743,11 @@ class Array
hash_val = size
return size if Thread.detect_outermost_recursion self do
i = to_iter
+ mask = Fixnum::MAX >> 1
while i.next
- hash_val ^= i.item.hash
+ hash_val &= mask
+ hash_val <<= 1
+ hash_val ^= i.item.hash
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment