We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 388ed61 commit 0c49b11Copy full SHA for 0c49b11
src/commonMain/kotlin/asia/hombre/kyber/internal/KyberMath.kt
@@ -375,8 +375,8 @@ internal class KyberMath {
375
fun moduloOf(value: Number, modulo: Number): Short {
376
val shortedValue = value.toInt()
377
val shortedModulo = modulo.toShort()
378
- return if(shortedValue < 0) (shortedModulo - (abs(shortedValue) % shortedModulo)).toShort()
379
- else (shortedValue % shortedModulo).toShort()
+ val isNegative = shortedValue < 0
+ return (((shortedModulo - (abs(shortedValue) % shortedModulo)) * isNegative.int) + ((shortedValue % shortedModulo) * (!isNegative).int)).toShort()
380
}
381
382
@JvmSynthetic
0 commit comments