Index: src/java/org/apache/lucene/util/OpenBitSet.java
===================================================================
--- src/java/org/apache/lucene/util/OpenBitSet.java	(revision 889000)
+++ src/java/org/apache/lucene/util/OpenBitSet.java	(working copy)
@@ -799,12 +799,16 @@
 
 
   public int hashCode() {
-      long h = 0x98761234;  // something non-zero for length==0
-      for (int i = bits.length; --i>=0;) {
+    // start with 0 hash and go backwards so zero padding at the end won't affect the hashcode
+    long h=0;
+    for (int i = wlen; --i>=0;) {
       h ^= bits[i];
       h = (h << 1) | (h >>> 63); // rotate left
     }
-    return (int)((h>>32) ^ h);  // fold leftmost bits into right
+
+    // something non-zero for length==0
+    // fold leftmost bits into right and add a constant to avoid common 0 hashcodes for empty bitsets
+    return (int)((h>>32) ^ h) + 0x98761234;
   }
 
 }
