Commit f50d8e3a authored by Him188's avatar Him188 Committed by Him188

Simplify expressions

parent 5dee91e7
...@@ -2,15 +2,8 @@ ...@@ -2,15 +2,8 @@
package net.mamoe.mirai.contact package net.mamoe.mirai.contact
import kotlin.math.pow
@Suppress("ObjectPropertyName")
private val `10EXP6` = 10.0.pow(6)
fun GroupId.toInternalId(): GroupInternalId { fun GroupId.toInternalId(): GroupInternalId {
if (this.value <= `10EXP6`) { if (this.value <= 10.0e6) {
return GroupInternalId(this.value) return GroupInternalId(this.value)
} }
val stringValue = this.value.toString() val stringValue = this.value.toString()
...@@ -33,7 +26,7 @@ fun GroupId.toInternalId(): GroupInternalId { ...@@ -33,7 +26,7 @@ fun GroupId.toInternalId(): GroupInternalId {
} }
fun GroupInternalId.toId(): GroupId = with(value.toString()) { fun GroupInternalId.toId(): GroupId = with(value.toString()) {
if (value < `10EXP6`) { if (value < 10.0e6) {
return GroupId(value) return GroupId(value)
} }
val left = this.dropLast(6).toLong() val left = this.dropLast(6).toLong()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment