paulirwin commented on code in PR #1068: URL: https://github.com/apache/lucenenet/pull/1068#discussion_r1890546061
########## src/Lucene.Net/Util/FixedBitSet.cs: ########## @@ -724,15 +724,18 @@ public override bool Equals(object o) public override int GetHashCode() { - long h = 0; - for (int i = numWords; --i >= 0; ) + unchecked { - h ^= bits[i]; - h = (h << 1) | (h >>> 63); // rotate left + long h = 0; + for (int i = numWords; --i >= 0; ) + { + h ^= bits[i]; + h = (h << 1) | (h >>> 63); // rotate left + } + // fold leftmost bits into right and add a constant to prevent + // empty sets from returning 0, which is too common. + return (int)((h >> 32) ^ h) + unchecked((int)0x98761234); Review Comment: Good catch on these, thanks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org