1.1 --- a/rt/emul/mini/src/main/java/java/lang/Float.java Wed Feb 27 16:24:42 2013 +0100
1.2 +++ b/rt/emul/mini/src/main/java/java/lang/Float.java Sat Mar 09 11:58:50 2013 +0100
1.3 @@ -710,15 +710,17 @@
1.4 * @return the bits that represent the floating-point number.
1.5 */
1.6 public static int floatToIntBits(float value) {
1.7 - throw new UnsupportedOperationException();
1.8 -// int result = floatToRawIntBits(value);
1.9 -// // Check for NaN based on values of bit fields, maximum
1.10 -// // exponent and nonzero significand.
1.11 -// if ( ((result & FloatConsts.EXP_BIT_MASK) ==
1.12 -// FloatConsts.EXP_BIT_MASK) &&
1.13 -// (result & FloatConsts.SIGNIF_BIT_MASK) != 0)
1.14 -// result = 0x7fc00000;
1.15 -// return result;
1.16 + final int EXP_BIT_MASK = 2139095040;
1.17 + final int SIGNIF_BIT_MASK = 8388607;
1.18 +
1.19 + int result = floatToRawIntBits(value);
1.20 + // Check for NaN based on values of bit fields, maximum
1.21 + // exponent and nonzero significand.
1.22 + if ( ((result & EXP_BIT_MASK) ==
1.23 + EXP_BIT_MASK) &&
1.24 + (result & SIGNIF_BIT_MASK) != 0)
1.25 + result = 0x7fc00000;
1.26 + return result;
1.27 }
1.28
1.29 /**
1.30 @@ -756,6 +758,11 @@
1.31 * @return the bits that represent the floating-point number.
1.32 * @since 1.3
1.33 */
1.34 + @JavaScriptBody(args = { "value" }, body = ""
1.35 + + "var a = new ArrayBuffer(4);"
1.36 + + "new Float32Array(a)[0] = value;"
1.37 + + "return new Int32Array(a)[0];"
1.38 + )
1.39 public static native int floatToRawIntBits(float value);
1.40
1.41 /**