Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
1 files changed, 2 insertions, 6 deletions
-rw-r--r--src/Models/CellFormula.cpp8
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 942b6e5..2e2636d 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -80,12 +80,8 @@ void CellFormula::parseAndSetValue(const char* str) {
if (currOp == '^') currOp *= -1;
else if ((currOp == '+' || currOp == '-') && formula.get_count() != 0) {
- unsigned cntr = 1;
- Pair<Cell*, char>& prev = formula[formula.get_count() - cntr];
- while (prev.right == '*' || prev.right == '/') {
- prev.right *= -1;
- prev = formula[formula.get_count() - ++cntr];
- }
+ for (unsigned i = formula.get_count() - 1; (formula[i].right == '*' || formula[i].right == '/') && i > 0; i--)
+ if (formula[i].right > 0) formula[i].right *= -1;
}
if (currOp == '-') {