re-apply bigint fix

This commit is contained in:
Alexander Nozik 2021-05-14 09:20:49 +03:00
parent 1b60f71ed0
commit 1a615c503d

View File

@ -108,9 +108,9 @@ public fun <T, S> Sequence<T>.averageWith(space: S): T where S : Ring<T>, S : Sc
* @author Evgeniy Zhelenskiy
*/
public fun <T> Ring<T>.power(arg: T, power: UInt): T = when {
this == zero && power > 0U -> zero
this == one -> arg
this == -one -> powWithoutOptimization(arg, power % 2U)
arg == zero && power > 0U -> zero
arg == one -> arg
arg == -one -> powWithoutOptimization(arg, power % 2U)
else -> powWithoutOptimization(arg, power)
}