total should be the sum of the vector result of an operation,

not sum the operands and then apply the operation.

--HG--
extra : convert_revision : 06486e59b3dd9588b458ef45c341cc4f2554dc09
This commit is contained in:
Nathan Binkert 2007-05-11 11:47:18 -07:00
parent 634d2e9d83
commit d667ce01b4

View file

@ -2094,9 +2094,13 @@ class UnaryNode : public Node
return vresult; return vresult;
} }
Result total() const { Result total() const
Op op; {
return op(l->total()); const VResult &vec = this->result();
Result total = 0;
for (int i = 0; i < size(); i++)
total += vec[i];
return total;
} }
virtual size_t size() const { return l->size(); } virtual size_t size() const { return l->size(); }
@ -2149,9 +2153,13 @@ class BinaryNode : public Node
return vresult; return vresult;
} }
Result total() const { Result total() const
Op op; {
return op(l->total(), r->total()); const VResult &vec = this->result();
Result total = 0;
for (int i = 0; i < size(); i++)
total += vec[i];
return total;
} }
virtual size_t size() const { virtual size_t size() const {