Change implementations of contentEquals and minOf/maxOf for Native
To conform to the behavior in other platforms.
This commit is contained in:
@@ -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
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user