Skip to content

Commit fc1e275

Browse files
committed
improve stack size mocking
sometimes negative values were calculated
1 parent 0a481dd commit fc1e275

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/stackmock.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ class StackMeasurer_c
9696
}
9797

9898
auto iValues = i;
99-
std::vector<std::pair<int, DWORD>> dDeltas { iMeasures };
99+
std::vector<std::pair<int, int>> dDeltas { iMeasures };
100100
sphLogDebugv( "========= start measure ==============" );
101-
std::pair<int,DWORD> dInitial {0,0};
101+
std::pair<int,int> dInitial {0,0};
102102
for ( i=0; i<iValues; ++i )
103103
{
104104
dDeltas[i].first = dMeasures[i].first-dInitial.first;
@@ -109,15 +109,16 @@ class StackMeasurer_c
109109

110110
int iStart = dMeasures.front().second;
111111

112-
uStack = 0;
112+
int iStack = 0;
113113
for ( i=iValues-1; i>0; --i )
114114
{
115115
if ( dDeltas[i].first !=1 )
116116
break;
117-
uStack = Max ( uStack, dDeltas[i].second );
117+
iStack = Max ( iStack, dDeltas[i].second );
118118
}
119+
assert (iStack>0);
119120

120-
int iDelta = sphRoundUp ( uStack, 8 );
121+
int iDelta = sphRoundUp ( iStack, 8 );
121122
return { iStart, iDelta };
122123
}
123124

0 commit comments

Comments
 (0)