From 096a144c536f242561519f0bb6e082e8b27c7730 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 24 Nov 2022 15:36:21 +0700 Subject: [PATCH] Use valueOf to avoid polluting heap --- .../dbotthepony/mc/otm/core/ImpreciseFraction.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/ImpreciseFraction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/ImpreciseFraction.kt index fb79cf399..90b78ff94 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/ImpreciseFraction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/ImpreciseFraction.kt @@ -407,7 +407,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return this } - return plus(ImpreciseFraction(other)) + return plus(valueOf(other)) } operator fun minus(other: Int): ImpreciseFraction { @@ -415,7 +415,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return this } - return minus(ImpreciseFraction(other)) + return minus(valueOf(other)) } operator fun times(other: Int): ImpreciseFraction { @@ -427,7 +427,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return times(ImpreciseFraction(other)) + return times(valueOf(other)) } operator fun div(other: Int): ImpreciseFraction { @@ -442,7 +442,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return div(ImpreciseFraction(other)) + return div(valueOf(other)) } operator fun plus(other: Long): ImpreciseFraction { @@ -450,7 +450,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return this } - return plus(ImpreciseFraction(other)) + return plus(valueOf(other)) } operator fun minus(other: Long): ImpreciseFraction { @@ -458,7 +458,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return this } - return minus(ImpreciseFraction(other)) + return minus(valueOf(other)) } operator fun times(other: Long): ImpreciseFraction { @@ -470,7 +470,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return times(ImpreciseFraction(other)) + return times(valueOf(other)) } operator fun div(other: Long): ImpreciseFraction { @@ -485,7 +485,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return div(ImpreciseFraction(other)) + return div(valueOf(other)) } operator fun plus(other: BigInteger): ImpreciseFraction {