mirror of
https://github.com/corda/corda.git
synced 2025-06-13 12:48:18 +00:00
Initial attempt at resolving SWT3.7 missing operatons in Avian. Everything seems to be working except floatToIntBits, hence the test case failing.
This commit is contained in:
@ -12,8 +12,10 @@ package java.lang;
|
||||
|
||||
public final class Float extends Number {
|
||||
public static final Class TYPE = Class.forCanonicalName("F");
|
||||
|
||||
private final float value;
|
||||
private static final int EXP_BIT_MASK = 0x7F800000;
|
||||
private static final int SIGNIF_BIT_MASK = 0x007FFFFF;
|
||||
|
||||
private final float value;
|
||||
|
||||
public Float(String value) {
|
||||
this.value = parseFloat(value);
|
||||
@ -88,6 +90,17 @@ public final class Float extends Number {
|
||||
throw new NumberFormatException(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static int floatToIntBits(float value) {
|
||||
int result = floatToRawIntBits(value);
|
||||
|
||||
// Check for NaN based on values of bit fields, maximum
|
||||
// exponent and nonzero significand.
|
||||
if (((result & EXP_BIT_MASK) == EXP_BIT_MASK) && (result & SIGNIF_BIT_MASK) != 0) {
|
||||
result = 0x7fc00000;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static native int floatToRawIntBits(float value);
|
||||
|
||||
|
Reference in New Issue
Block a user