Skip to content

Commit 31d6768

Browse files
authored
1 parent ef022f5 commit 31d6768

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: src/main/scala/chisel3/util/BitwiseImpl.scala

+4-5
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ private[chisel3] trait ReverseImpl {
5656
var res = in
5757
var shift = length >> 1
5858
var mask = ((BigInt(1) << length) - 1).asUInt(length.W)
59-
var initial = true
60-
while (initial || shift > 0) {
61-
initial = false
59+
while ({
6260
mask = mask ^ (mask(length - shift - 1, 0) << shift)
63-
res = ((res >> shift) & mask) | ((res(length - shift - 1, 0) << shift) & !mask)
61+
res = ((res >> shift) & mask) | ((res(length - shift - 1, 0) << shift) & ~mask)
6462
shift = shift >> 1
65-
}
63+
shift > 0
64+
}) {}
6665
res
6766
case _ =>
6867
val half = (1 << log2Ceil(length)) / 2

0 commit comments

Comments
 (0)