mirror of https://github.com/apache/lucene.git
use floatToRawIntBits and doubleToRawLongBits for encoding float values as normalization is not needed and much faster
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@786770 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
65131ca7b9
commit
579a0704cd
|
@ -300,7 +300,7 @@ public final class NumericUtils {
|
||||||
* @see #sortableLongToDouble
|
* @see #sortableLongToDouble
|
||||||
*/
|
*/
|
||||||
public static long doubleToSortableLong(double val) {
|
public static long doubleToSortableLong(double val) {
|
||||||
long f = Double.doubleToLongBits(val);
|
long f = Double.doubleToRawLongBits(val);
|
||||||
if (f<0) f ^= 0x7fffffffffffffffL;
|
if (f<0) f ^= 0x7fffffffffffffffL;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ public final class NumericUtils {
|
||||||
* @see #sortableIntToFloat
|
* @see #sortableIntToFloat
|
||||||
*/
|
*/
|
||||||
public static int floatToSortableInt(float val) {
|
public static int floatToSortableInt(float val) {
|
||||||
int f = Float.floatToIntBits(val);
|
int f = Float.floatToRawIntBits(val);
|
||||||
if (f<0) f ^= 0x7fffffff;
|
if (f<0) f ^= 0x7fffffff;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue