Update Calc Engine for new functions needed for keyboard refresh (#662)

* Update Calc Engine to Support New Functionality

* Address PR comments

* Address PR comments
This commit is contained in:
Pepe Rivera 2019-09-30 14:04:20 -07:00 committed by GitHub
parent d9bf57ff99
commit 9cb0932eaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 849 additions and 176 deletions

View file

@ -28,6 +28,14 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
result ^= rhs;
break;
case IDC_NAND:
result = (result & rhs) ^ m_chopNumbers[m_numwidth];
break;
case IDC_NOR:
result = (result | rhs) ^ m_chopNumbers[m_numwidth];
break;
case IDC_RSHF:
{
if (m_fIntegerMode && result >= m_dwWordBitWidth) // Lsh/Rsh >= than current word size is always 0
@ -52,7 +60,16 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
}
break;
}
case IDC_RSHFL:
{
if (m_fIntegerMode && result >= m_dwWordBitWidth) // Lsh/Rsh >= than current word size is always 0
{
throw CALC_E_NORESULT;
}
result = rhs >> result;
break;
}
case IDC_LSHF:
if (m_fIntegerMode && result >= m_dwWordBitWidth) // Lsh/Rsh >= than current word size is always 0
{
@ -140,6 +157,10 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
case IDC_ROOT: // Calculates rhs to the result(th) root.
result = Root(rhs, result);
break;
case IDC_LOGBASEX:
result = (Log(result) / Log(rhs));
break;
}
}
catch (uint32_t dwErrCode)