Added intrinsics for nullable Double/Float equals check

This commit is contained in:
Mikhael Bogdanov
2017-02-02 11:04:58 +01:00
parent 87529f957d
commit 5cffb3892d
39 changed files with 1038 additions and 10 deletions
@@ -163,6 +163,30 @@ public class Intrinsics {
return first == null ? second == null : first.equals(second);
}
public static boolean areEqual(Double first, Double second) {
return first == null ? second == null : second != null && first.doubleValue() == second.doubleValue();
}
public static boolean areEqual(Double first, double second) {
return first != null && first.doubleValue() == second;
}
public static boolean areEqual(double first, Double second) {
return second != null && first == second.doubleValue();
}
public static boolean areEqual(Float first, Float second) {
return first == null ? second == null : second != null && first.floatValue() == second.floatValue();
}
public static boolean areEqual(Float first, float second) {
return first != null && first.floatValue() == second;
}
public static boolean areEqual(float first, Float second) {
return second != null && first == second.floatValue();
}
public static void throwUndefinedForReified() {
throwUndefinedForReified(
"This function has a reified type parameter and thus can only be inlined at compilation time, not called directly."