Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

use floatToRawIntBits and doubleToRawLongBits for encoding float values as normalization is not needed and much faster

Uwe Schindler579a0704cd90
diff --git a/src/java/org/apache/lucene/util/NumericUtils.java b/src/java/org/apache/lucene/util/NumericUtils.java
index 65276261e7a..8620efa40e3 100644
--- a/src/java/org/apache/lucene/util/NumericUtils.java
+++ b/src/java/org/apache/lucene/util/NumericUtils.java
@@ -300,7 +300,7 @@ public final class NumericUtils {
* @see #sortableLongToDouble
*/
public static long doubleToSortableLong(double val) {
- long f = Double.doubleToLongBits(val);
+ long f = Double.doubleToRawLongBits(val);
if (f<0) f ^= 0x7fffffffffffffffL;
return f;
}
@@ -322,7 +322,7 @@ public final class NumericUtils {
* @see #sortableIntToFloat
*/
public static int floatToSortableInt(float val) {
- int f = Float.floatToIntBits(val);
+ int f = Float.floatToRawIntBits(val);
if (f<0) f ^= 0x7fffffff;
return f;
}