Constify LSB subtractions immediately, no functional change intended
This commit is contained in:
parent
114af7d33f
commit
bcd90d3401
|
|
@ -100,6 +100,13 @@ private:
|
||||||
// have to deal with signed math and related 32bit sign extension problems
|
// have to deal with signed math and related 32bit sign extension problems
|
||||||
if (rhs == 0) {
|
if (rhs == 0) {
|
||||||
return lhsp;
|
return lhsp;
|
||||||
|
} else if (lhsp->castConst()) {
|
||||||
|
// Optional vs just making add/sub below, but saves constification some work
|
||||||
|
V3Number num (lhsp->fileline(), lhsp->width());
|
||||||
|
num.opSub(lhsp->castConst()->num(), V3Number(lhsp->fileline(), 32, rhs));
|
||||||
|
num.isSigned(lhsp->isSigned());
|
||||||
|
AstNode* newp = new AstConst(lhsp->fileline(), num);
|
||||||
|
return newp;
|
||||||
} else if (rhs > 0) {
|
} else if (rhs > 0) {
|
||||||
// We must make sure sub gets sign of original value
|
// We must make sure sub gets sign of original value
|
||||||
AstNode* newp = new AstSub(lhsp->fileline(), lhsp,
|
AstNode* newp = new AstSub(lhsp->fileline(), lhsp,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue