summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util/Bitwise.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/chisel3/util/Bitwise.scala')
-rw-r--r--src/main/scala/chisel3/util/Bitwise.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/scala/chisel3/util/Bitwise.scala b/src/main/scala/chisel3/util/Bitwise.scala
index 92ebddb4..4fc4d78c 100644
--- a/src/main/scala/chisel3/util/Bitwise.scala
+++ b/src/main/scala/chisel3/util/Bitwise.scala
@@ -103,11 +103,11 @@ object Reverse {
var res = in
var shift = length >> 1
var mask = ((BigInt(1) << length) - 1).asUInt(length.W)
- do {
+ while (shift > 0) do {
mask = mask ^ (mask(length - shift - 1, 0) << shift)
res = ((res >> shift) & mask) | ((res(length - shift - 1, 0) << shift) & ~mask)
shift = shift >> 1
- } while (shift > 0)
+ }
res
case _ =>
val half = (1 << log2Ceil(length)) / 2