Lucene.Net.Core.Util.Fst.NodeHash: Fixed GetHashCode() calls to use Collections.GetHashCode() on reference types
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/7fd381b4 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/7fd381b4 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/7fd381b4 Branch: refs/heads/api-work Commit: 7fd381b444beaf038e2abb341175fc1e2a81a9bd Parents: 6c9a3c6 Author: Shad Storhaug <[email protected]> Authored: Thu Mar 30 13:08:25 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 30 13:08:25 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Util/Fst/NodeHash.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7fd381b4/src/Lucene.Net.Core/Util/Fst/NodeHash.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs index 0a3104d..207fa04 100644 --- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs +++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs @@ -95,10 +95,10 @@ namespace Lucene.Net.Util.Fst h = PRIME * h + arc.Label; long n = ((Builder.CompiledNode)arc.Target).Node; h = PRIME * h + (int)(n ^ (n >> 32)); - h = PRIME * h + arc.Output.GetHashCode(); // LUCENENET specific - optimize the Hash methods // by only calling Collections.GetHashCode() if the value is a reference type + h = PRIME * h + (tIsValueType ? arc.Output.GetHashCode() : Collections.GetHashCode(arc.Output)); h = PRIME * h + (tIsValueType ? arc.NextFinalOutput.GetHashCode() : Collections.GetHashCode(arc.NextFinalOutput)); if (arc.IsFinal) { @@ -123,10 +123,10 @@ namespace Lucene.Net.Util.Fst //System.out.println(" label=" + scratchArc.label + " target=" + scratchArc.target + " h=" + h + " output=" + fst.outputs.outputToString(scratchArc.output) + " next?=" + scratchArc.flag(4) + " final?=" + scratchArc.isFinal() + " pos=" + in.getPosition()); h = PRIME * h + scratchArc.Label; h = PRIME * h + (int)(scratchArc.Target ^ (scratchArc.Target >> 32)); - h = PRIME * h + scratchArc.Output.GetHashCode(); // LUCENENET specific - optimize the Hash methods // by only calling Collections.GetHashCode() if the value is a reference type + h = PRIME * h + (tIsValueType ? scratchArc.Output.GetHashCode() : Collections.GetHashCode(scratchArc.Output)); h = PRIME * h + (tIsValueType ? scratchArc.NextFinalOutput.GetHashCode() : Collections.GetHashCode(scratchArc.NextFinalOutput)); if (scratchArc.IsFinal) {
