com.jtransc.numeric.multiples.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-utils Show documentation
Show all versions of jtransc-utils Show documentation
JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.
package com.jtransc.numeric
private fun roundUp(numToRound:Int, multiple:Int): Int
{
if (multiple == 0)
return numToRound;
val remainder = Math.abs(numToRound) % multiple;
if (remainder == 0)
return numToRound;
if (numToRound < 0)
return -(Math.abs(numToRound) - remainder);
else
return numToRound + multiple - remainder;
}
fun Int.nextMultipleOf(multiple:Int):Int = roundUp(this, multiple)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy