From b3a84cc84c00ac8532e594499e052921cfc9f61a Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Fri, 30 Sep 2022 09:21:58 -0400 Subject: [PATCH] Digit should be MANTTYPE It makes more sense that way, especially when directly cast to one. --- src/CalcManager/CEngine/scicomm.cpp | 7 ++----- src/CalcManager/Ratpack/basex.cpp | 4 ++-- src/CalcViewModel/StandardCalculatorViewModel.cpp | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/CalcManager/CEngine/scicomm.cpp b/src/CalcManager/CEngine/scicomm.cpp index 701fb21c83..d2b4b5e19d 100644 --- a/src/CalcManager/CEngine/scicomm.cpp +++ b/src/CalcManager/CEngine/scicomm.cpp @@ -482,8 +482,7 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam) ResolveHighestPrecedenceOperation(); while (m_fPrecedence && m_precedenceOpCount > 0) { - m_precedenceOpCount--; - m_nOpCode = m_nPrecOp[m_precedenceOpCount]; + m_nOpCode = m_nPrecOp[--m_precedenceOpCount]; m_lastVal = m_precedenceVals[m_precedenceOpCount]; // Precedence Inversion check @@ -601,9 +600,7 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam) m_HistoryCollector.AddCloseBraceToHistory(); // Now get back the operation and opcode at the beginning of this parenthesis pair - - m_openParenCount -= 1; - m_lastVal = m_parenVals[m_openParenCount]; + m_lastVal = m_parenVals[--m_openParenCount]; m_nOpCode = m_nOp[m_openParenCount]; // m_bChangeOp should be true if m_nOpCode is valid diff --git a/src/CalcManager/Ratpack/basex.cpp b/src/CalcManager/Ratpack/basex.cpp index 27e6a223e1..345ac435f3 100644 --- a/src/CalcManager/Ratpack/basex.cpp +++ b/src/CalcManager/Ratpack/basex.cpp @@ -298,7 +298,7 @@ void _divnumx(PNUMBER* pa, PNUMBER b, int32_t precision) while (cdigits++ < thismax && !zernum(rem)) { - int32_t digit = 0; + MANTTYPE digit = 0; *ptrc = 0; while (!lessnum(rem, b)) { @@ -334,7 +334,7 @@ void _divnumx(PNUMBER* pa, PNUMBER b, int32_t precision) cdigits--; if (c->mant != ++ptrc) { - memmove(c->mant, ptrc, (int)(cdigits * sizeof(MANTTYPE))); + memmove(c->mant, ptrc, cdigits * sizeof(MANTTYPE)); } if (!cdigits) diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index 22554ca650..b8112e8d1c 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -573,7 +573,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum) temp[i] = data[j++]; } temp[i] = L'\0'; - commandIndex += 1; + commandIndex++; } }