You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2012/09/23 01:05:09 UTC

svn commit: r1388919 - /lucene.net/trunk/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs

Author: synhershko
Date: Sat Sep 22 23:05:09 2012
New Revision: 1388919

URL: http://svn.apache.org/viewvc?rev=1388919&view=rev
Log:
Implementing RFF's GetHashCode

Modified:
    lucene.net/trunk/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs

Modified: lucene.net/trunk/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs?rev=1388919&r1=1388918&r2=1388919&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs Sat Sep 22 23:05:09 2012
@@ -92,11 +92,9 @@ namespace Lucene.Net.Spatial.Util
 
         public override int GetHashCode()
         {
-            throw new NotImplementedException();
-            //TODO
-            //int h = Float.floatToIntBits(a) + Float.floatToIntBits(m);
-            //h ^= (h << 13) | (h >>> 20);
-            //return h + (Float.floatToIntBits(b)) + source.hashCode();
+            int h = (int) BitConverter.DoubleToInt64Bits(a) + (int) BitConverter.DoubleToInt64Bits(m);
+            h ^= (h << 13) | (int)((uint)h >> 20);
+            return h + ((int) BitConverter.DoubleToInt64Bits(b)) + source.GetHashCode();
         }
     }
 }