We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ef022f5 commit 31d6768Copy full SHA for 31d6768
src/main/scala/chisel3/util/BitwiseImpl.scala
@@ -56,13 +56,12 @@ private[chisel3] trait ReverseImpl {
56
var res = in
57
var shift = length >> 1
58
var mask = ((BigInt(1) << length) - 1).asUInt(length.W)
59
- var initial = true
60
- while (initial || shift > 0) {
61
- initial = false
+ while ({
62
mask = mask ^ (mask(length - shift - 1, 0) << shift)
63
- res = ((res >> shift) & mask) | ((res(length - shift - 1, 0) << shift) & !mask)
+ res = ((res >> shift) & mask) | ((res(length - shift - 1, 0) << shift) & ~mask)
64
shift = shift >> 1
65
- }
+ shift > 0
+ }) {}
66
res
67
case _ =>
68
val half = (1 << log2Ceil(length)) / 2
0 commit comments