1
0

Avoid needless Vec generation

This commit is contained in:
Andrew Waterman 2016-04-27 00:28:39 -07:00
parent 8acec8eb36
commit b99db83e67

View File

@ -160,5 +160,5 @@ object Random
private def round(x: Double): Int = private def round(x: Double): Int =
if (x.toInt.toDouble == x) x.toInt else (x.toInt + 1) & -2 if (x.toInt.toDouble == x) x.toInt else (x.toInt + 1) & -2
private def partition(value: UInt, slices: Int) = private def partition(value: UInt, slices: Int) =
Vec.tabulate(slices)(i => value < round((i << value.getWidth).toDouble / slices)) Seq.tabulate(slices)(i => value < round((i << value.getWidth).toDouble / slices))
} }