From f50d8e3afb2e08dd02125c5cd4af8fe7b8754c9e Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 31 Dec 2019 17:02:10 +0800 Subject: [PATCH] Simplify expressions --- .../net.mamoe.mirai/contact/GroupIdConvertions.kt | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/GroupIdConvertions.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/GroupIdConvertions.kt index 45b0b4905..3bc10dd2c 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/GroupIdConvertions.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/GroupIdConvertions.kt @@ -2,15 +2,8 @@ package net.mamoe.mirai.contact -import kotlin.math.pow - - -@Suppress("ObjectPropertyName") -private val `10EXP6` = 10.0.pow(6) - - fun GroupId.toInternalId(): GroupInternalId { - if (this.value <= `10EXP6`) { + if (this.value <= 10.0e6) { return GroupInternalId(this.value) } val stringValue = this.value.toString() @@ -33,7 +26,7 @@ fun GroupId.toInternalId(): GroupInternalId { } fun GroupInternalId.toId(): GroupId = with(value.toString()) { - if (value < `10EXP6`) { + if (value < 10.0e6) { return GroupId(value) } val left = this.dropLast(6).toLong()