Skip to content

Commit

Permalink
Max index can be directly computed in safeSigRDTbl/safeSigWRTbl since…
Browse files Browse the repository at this point in the history
… size in actually an int.
  • Loading branch information
sletz committed May 6, 2023
1 parent 6413425 commit 4309b5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/transform/sigPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ Tree SignalTablePromotion::safeSigRDTbl(Tree sig, Tree tbl, Tree size_aux, Tree
<< size << ") in : " << ppsig(sig, MAX_ERROR_SIZE);
gWarningMessages.push_back(error.str());
}
return sigRDTbl(self(tbl), sigMax(sigInt(0), sigMin(self(ri), sigSub(size_aux, sigInt(1)))));
return sigRDTbl(self(tbl), sigMax(sigInt(0), sigMin(self(ri), sigInt(size-1))));
} else {
// Other cases => identity transformation
return SignalIdentity::transformation(sig);
Expand All @@ -521,7 +521,7 @@ Tree SignalTablePromotion::safeSigWRTbl(Tree sig, Tree size_aux, Tree gen, Tree
<< size << ") in : " << ppsig(sig, MAX_ERROR_SIZE);
gWarningMessages.push_back(error.str());
}
return sigWRTbl(self(size_aux), self(gen), sigMax(sigInt(0), sigMin(self(wi), sigSub(size_aux, sigInt(1)))), self(ws));
return sigWRTbl(self(size_aux), self(gen), sigMax(sigInt(0), sigMin(self(wi), sigInt(size-1))), self(ws));
} else {
// Other cases => identity transformation
return SignalIdentity::transformation(sig);
Expand Down

0 comments on commit 4309b5e

Please sign in to comment.