nl.vroste.rezilience.Util.scala Maven / Gradle / Ivy
package nl.vroste.rezilience
private object Util {
final def nextPow2(n: Int): Int = {
val nextPow = (Math.log(n.toDouble) / Math.log(2.0)).ceil.toInt
Math.pow(2.0, nextPow.toDouble).toInt.max(2)
}
}