Implement unsigned comparisons
This commit is contained in:
@@ -86,7 +86,13 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
*/""")
|
||||
out.print(" public ")
|
||||
if (otherType == type) out.print("override ")
|
||||
out.println("operator fun compareTo(other: ${otherType.capitalized}): Int = TODO()")
|
||||
out.print("operator fun compareTo(other: ${otherType.capitalized}): Int = ")
|
||||
if (otherType == type && maxByDomainCapacity(type, UnsignedType.UINT) == type) {
|
||||
out.println("${className.toLowerCase()}Compare(this.data, other.data)")
|
||||
} else {
|
||||
val ctype = maxByDomainCapacity(maxByDomainCapacity(type, otherType), UnsignedType.UINT)
|
||||
out.println("${convert("this", type, ctype)}.compareTo(${convert("other", otherType, ctype)})")
|
||||
}
|
||||
}
|
||||
out.println()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user