Add lsb index to V3Number::setMask (#5522)

This commit is contained in:
Geza Lore
2024-10-08 13:15:36 +01:00
committed by GitHub
parent b873c23cf2
commit 8f1ea09558
5 changed files with 11 additions and 14 deletions
+1 -4
View File
@@ -531,10 +531,7 @@ class DelayedVisitor final : public VNVisitor {
// Constant mask we can compute here
if (AstConst* const cLsbp = VN_CAST(sLsbp, Const)) {
AstConst* const cp = new AstConst{flp, AstConst::DTyped{}, eDTypep};
cp->num().setAllBits0();
const int lsb = cLsbp->toSInt();
const int msb = lsb + sWidthp->toSInt() - 1;
for (int bit = lsb; bit <= msb; ++bit) cp->num().setBit(bit, '1');
cp->num().setMask(sWidthp->toSInt(), cLsbp->toSInt());
return cp;
}