++level;
// Variable stack_dist is updated only
// when arriving from Left.
- if(from_left) {
+ if (from_left) {
stack_dist += node->sumRight;
}
// Recursively call the getSum operation till the
// root node is reached
- if(node->parent) {
+ if (node->parent) {
stack_dist = getSum(node->parent, node->isLeftNode,
node->sumLeft + node->sumRight,
stack_dist, level);
StackDistCalc::calcStackDistAndUpdate(const Addr r_address, bool addNewNode)
{
Node* newLeafNode;
- // Return index if the address was already present in stack
- uint64_t r_index = index;
auto ai = aiMap.lower_bound(r_address);
// key already exists
// save the index counter value when this address was
// encountered before and update it to the current index value
- r_index = ai->second;
+ uint64_t r_index = ai->second;
if (addNewNode) {
// Update aiMap aiMap(Address) = current index
std::pair< uint64_t, bool>
StackDistCalc::calcStackDist(const Addr r_address, bool mark)
{
- // Return index if the address was already present in stack
- uint64_t r_index = index;
// Default value of isMarked flag for each node.
bool _mark = false;
// key already exists
// save the index counter value when this address was
// encountered before
- r_index = ai->second;
+ uint64_t r_index = ai->second;
// Get the value of mark flag if previously marked
_mark = tree[0][r_index]->isMarked;
StackDistCalc::printStack(int n) const
{
Node* node;
- uint64_t r_index;
int count = 0;
DPRINTF(StackDist, "Printing last %d entries in tree\n", n);
for (auto it = tree[0].rbegin(); (count < n) && (it != tree[0].rend());
++it, ++count) {
node = it->second;
- r_index = node->nodeIndex;
+ uint64_t r_index = node->nodeIndex;
// Lookup aiMap using the index returned by the leaf iterator
for (auto ai = aiMap.rbegin(); ai != aiMap.rend(); ++ai) {