Change implementations of contentEquals and minOf/maxOf for Native

To conform to the behavior in other platforms.
This commit is contained in:
Ilya Gorbunov
2018-12-27 04:50:12 +03:00
parent a951805218
commit a26aa30714
2 changed files with 9 additions and 17 deletions
@@ -99,18 +99,16 @@ object ArrayOps : TemplateGroupBase() {
}
}
on(Platform.Native) {
fun notEq(operand1: String, operand2: String) = when {
primitive?.isFloatingPoint() == true -> "!$operand1.equals($operand2)"
else -> "$operand1 != $operand2"
}
body {
"""
if (this === other) {
return true
}
if (size != other.size) {
return false
}
if (this === other) return true
if (size != other.size) return false
for (i in indices) {
if (this[i] != other[i]) {
return false
}
if (${notEq("this[i]", "other[i]")}) return false
}
return true
"""
@@ -178,11 +178,10 @@ object ComparableOps : TemplateGroupBase() {
on(Platform.Native) {
body {
"""
// TODO: Check +/-0.0
return when {
a.isNaN() -> a
b.isNaN() -> b
else -> $defaultImpl
else -> if (a.compareTo(b) <= 0) a else b
}
"""
}
@@ -318,12 +317,7 @@ object ComparableOps : TemplateGroupBase() {
on(Platform.Native) {
body {
"""
// TODO: Check +/-0.0
return when {
a.isNaN() -> a
b.isNaN() -> b
else -> $defaultImpl
}
return if (a.compareTo(b) >= 0) a else b
"""
}
}