Skip to content

Commit f25f9e9

Browse files
authored
[Common] Adding overflow short-circuit (#13336)
1 parent db9c11c commit f25f9e9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Common/TableProducer/occupancyTableProducer.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,15 +2708,17 @@ struct CreatePointerTables {
27082708
// create pointer table
27092709
int currentIDXforCheck = 0;
27102710
int listSize = trackGIForTrackQAIndexList.size();
2711+
bool breakOnOverflow = false;
27112712

27122713
for (const auto& track : tracks) {
2713-
while (track.globalIndex() > trackGIForTrackQAIndexList[currentIDXforCheck][0]) {
2714+
while (!breakOnOverflow && track.globalIndex() > trackGIForTrackQAIndexList[currentIDXforCheck][0]) {
27142715
currentIDXforCheck++; // increment the currentIDXforCheck for missing or invalid cases e.g. value = -1;
27152716
if (currentIDXforCheck >= listSize) {
2717+
breakOnOverflow = true;
27162718
break;
27172719
}
27182720
}
2719-
if (track.globalIndex() == trackGIForTrackQAIndexList[currentIDXforCheck][0]) {
2721+
if (!breakOnOverflow && track.globalIndex() == trackGIForTrackQAIndexList[currentIDXforCheck][0]) {
27202722
genTrackToTracksQA(trackGIForTrackQAIndexList[currentIDXforCheck][1]);
27212723
} else {
27222724
genTrackToTracksQA(-1); // put a dummy index when track is not found in trackQA
@@ -2741,15 +2743,17 @@ struct CreatePointerTables {
27412743
// create pointer table
27422744
int currentIDXforCheck = 0;
27432745
int listSize = trackGIForTMOIndexList.size();
2746+
bool breakOnOverflow = false;
27442747

27452748
for (const auto& track : tracks) {
2746-
while (track.globalIndex() > trackGIForTMOIndexList[currentIDXforCheck][0]) {
2749+
while (!breakOnOverflow && track.globalIndex() > trackGIForTMOIndexList[currentIDXforCheck][0]) {
27472750
currentIDXforCheck++; // increment the currentIDXforCheck for missing or invalid cases e.g. value = -1;
27482751
if (currentIDXforCheck >= listSize) {
2752+
breakOnOverflow = true;
27492753
break;
27502754
}
27512755
}
2752-
if (track.globalIndex() == trackGIForTMOIndexList[currentIDXforCheck][0]) {
2756+
if (!breakOnOverflow && track.globalIndex() == trackGIForTMOIndexList[currentIDXforCheck][0]) {
27532757
genTrackToTmo(trackGIForTMOIndexList[currentIDXforCheck][1]);
27542758
} else {
27552759
genTrackToTmo(-1); // put a dummy index when track is not found in trackQA

0 commit comments

Comments
 (0)