mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Make m_dwWordBitWidth unsigned
Also adjust parameter types to accommodate this
This commit is contained in:
parent
59b3934c83
commit
0bc0826cd2
5 changed files with 9 additions and 9 deletions
|
@ -56,7 +56,7 @@ bool CalcInput::TryToggleSign(bool isIntegerMode, wstring_view maxNumStr)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CalcInput::TryAddDigit(unsigned int value, uint32_t radix, bool isIntegerMode, wstring_view maxNumStr, int32_t wordBitWidth, int maxDigits)
|
||||
bool CalcInput::TryAddDigit(unsigned int value, uint32_t radix, bool isIntegerMode, wstring_view maxNumStr, uint32_t wordBitWidth, int maxDigits)
|
||||
{
|
||||
// Convert from an integer into a character
|
||||
// This includes both normal digits and alpha 'digits' for radixes > 10
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace CalcEngine;
|
||||
using namespace CalcEngine::RationalMath;
|
||||
using namespace RationalMath;
|
||||
|
||||
/* Routines for more complex mathematical functions/error checking. */
|
||||
CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& rat, uint32_t op)
|
||||
Rational CCalcEngine::SciCalcFunctions(Rational const& rat, uint32_t op)
|
||||
{
|
||||
Rational result{};
|
||||
try
|
||||
|
@ -39,7 +39,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||
case IDC_COM:
|
||||
if (m_radix == 10 && !m_fIntegerMode)
|
||||
{
|
||||
result = -(RationalMath::Integer(rat) + 1);
|
||||
result = -(Integer(rat) + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||
result = Integer(rat);
|
||||
|
||||
uint64_t w64Bits = result.ToUInt64_t();
|
||||
uint64_t lsb = ((w64Bits & 0x01) == 1) ? 1 : 0;
|
||||
uint64_t lsb = w64Bits & 0x01;
|
||||
w64Bits >>= 1; // RShift by 1
|
||||
|
||||
if (op == IDC_ROR)
|
||||
|
|
|
@ -50,7 +50,7 @@ void CCalcEngine::SetRadixTypeAndNumWidth(RadixType radixtype, NUM_WIDTH numwidt
|
|||
DisplayNum();
|
||||
}
|
||||
|
||||
int32_t CCalcEngine::DwWordBitWidthFromNumWidth(NUM_WIDTH numwidth)
|
||||
uint32_t CCalcEngine::DwWordBitWidthFromNumWidth(NUM_WIDTH numwidth)
|
||||
{
|
||||
switch (numwidth)
|
||||
{
|
||||
|
|
|
@ -149,7 +149,7 @@ private:
|
|||
int m_nLastCom; // Last command entered.
|
||||
AngleType m_angletype; // Current Angle type when in dec mode. one of deg, rad or grad
|
||||
NUM_WIDTH m_numwidth; // one of qword, dword, word or byte mode.
|
||||
int32_t m_dwWordBitWidth; // # of bits in currently selected word size
|
||||
uint32_t m_dwWordBitWidth; // # of bits in currently selected word size
|
||||
|
||||
std::unique_ptr<std::mt19937> m_randomGeneratorEngine;
|
||||
std::unique_ptr<std::uniform_real_distribution<>> m_distr;
|
||||
|
@ -179,7 +179,7 @@ private:
|
|||
CalcEngine::Rational SciCalcFunctions(CalcEngine::Rational const& rat, uint32_t op);
|
||||
CalcEngine::Rational DoOperation(int operation, CalcEngine::Rational const& lhs, CalcEngine::Rational const& rhs);
|
||||
void SetRadixTypeAndNumWidth(RadixType radixtype, NUM_WIDTH numwidth);
|
||||
int32_t DwWordBitWidthFromNumWidth(NUM_WIDTH numwidth);
|
||||
uint32_t DwWordBitWidthFromNumWidth(NUM_WIDTH numwidth);
|
||||
uint32_t NRadixFromRadixType(RadixType radixtype);
|
||||
double GenerateRandomNumber();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace CalcEngine
|
|||
|
||||
void Clear();
|
||||
bool TryToggleSign(bool isIntegerMode, std::wstring_view maxNumStr);
|
||||
bool TryAddDigit(unsigned int value, uint32_t radix, bool isIntegerMode, std::wstring_view maxNumStr, int32_t wordBitWidth, int maxDigits);
|
||||
bool TryAddDigit(unsigned int value, uint32_t radix, bool isIntegerMode, std::wstring_view maxNumStr, uint32_t wordBitWidth, int maxDigits);
|
||||
bool TryAddDecimalPt();
|
||||
bool HasDecimalPt();
|
||||
bool TryBeginExponent();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue