You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2012/05/29 20:59:55 UTC
svn commit: r1343920 - in /commons/proper/math/trunk/src: changes/changes.xml
main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java
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.