Fold all SEConstantNode that appear in |recurrences| and |constants| into a single integer value.
| 133 | // Fold all SEConstantNode that appear in |recurrences| and |constants| into a |
| 134 | // single integer value. |
| 135 | int64_t CalculateConstantTerm(const std::vector<SERecurrentNode*>& recurrences, |
| 136 | const std::vector<SEConstantNode*>& constants) { |
| 137 | int64_t constant_term = 0; |
| 138 | for (auto recurrence : recurrences) { |
| 139 | constant_term += |
| 140 | recurrence->GetOffset()->AsSEConstantNode()->FoldToSingleValue(); |
| 141 | } |
| 142 | |
| 143 | for (auto constant : constants) { |
| 144 | constant_term += constant->FoldToSingleValue(); |
| 145 | } |
| 146 | |
| 147 | return constant_term; |
| 148 | } |
| 149 | |
| 150 | int64_t CalculateGCDFromCoefficients( |
| 151 | const std::vector<SERecurrentNode*>& recurrences, int64_t running_gcd) { |
no test coverage detected