commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1343920 - in /commons/proper/math/trunk/src: changes/changes.xml main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java
Date Tue, 29 May 2012 18:59:55 GMT
Author: luc
Date: Tue May 29 18:59:54 2012
New Revision: 1343920

URL: http://svn.apache.org/viewvc?rev=1343920&view=rev
Log:
Use inline computation for OrderedTuple hash code.

JIRA: MATH-793

Modified:
    commons/proper/math/trunk/src/changes/changes.xml
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java

Modified: commons/proper/math/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1343920&r1=1343919&r2=1343920&view=diff
==============================================================================
--- commons/proper/math/trunk/src/changes/changes.xml (original)
+++ commons/proper/math/trunk/src/changes/changes.xml Tue May 29 18:59:54 2012
@@ -52,6 +52,9 @@ If the output is not quite correct, chec
   <body>
     <release version="3.1" date="TBD" description="
 ">
+      <action dev="luc" type="fix" issue="MATH-793"  due-to="Sebb">
+        Use inline computation for OrderedTuple hash code.
+      </action>
       <action dev="tn" type="fix" issue="MATH-718" >
         Use modified Lentz-Thompson algorithm for continued fraction evaluation to avoid
         underflows.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java?rev=1343920&r1=1343919&r2=1343920&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java
Tue May 29 18:59:54 2012
@@ -301,12 +301,10 @@ public class OrderedTuple implements Com
     /** {@inheritDoc} */
     @Override
     public int hashCode() {
-        return Arrays.hashCode(components)        ^
-               Integer.valueOf(offset).hashCode() ^
-               Integer.valueOf(lsb).hashCode()    ^
-               Boolean.valueOf(posInf).hashCode() ^
-               Boolean.valueOf(negInf).hashCode() ^
-               Boolean.valueOf(nan).hashCode();
+        return Arrays.hashCode(components) * offset * (lsb << 7) +
+               ((posInf ?  43422 : 875342) *
+                (negInf ? 86535631 : 632442767) *
+                (nan ? 51108941 : 64234));
     }
 
     /** Get the components array.



Mime
View raw message