mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 13:53:11 -07:00
No need to invoke the compare method when we have an overloaded == operator. (#1091)
This commit is contained in:
parent
d14423d0f1
commit
172bf08122
1 changed files with 5 additions and 5 deletions
|
@ -244,9 +244,9 @@ Unit UnitConverter::StringToUnit(wstring_view w)
|
||||||
serializedUnit.name = Unquote(tokenList[1]);
|
serializedUnit.name = Unquote(tokenList[1]);
|
||||||
serializedUnit.accessibleName = serializedUnit.name;
|
serializedUnit.accessibleName = serializedUnit.name;
|
||||||
serializedUnit.abbreviation = Unquote(tokenList[2]);
|
serializedUnit.abbreviation = Unquote(tokenList[2]);
|
||||||
serializedUnit.isConversionSource = (tokenList[3].compare(L"1") == 0);
|
serializedUnit.isConversionSource = (tokenList[3] == L"1");
|
||||||
serializedUnit.isConversionTarget = (tokenList[4].compare(L"1") == 0);
|
serializedUnit.isConversionTarget = (tokenList[4] == L"1");
|
||||||
serializedUnit.isWhimsical = (tokenList[5].compare(L"1") == 0);
|
serializedUnit.isWhimsical = (tokenList[5] == L"1");
|
||||||
return serializedUnit;
|
return serializedUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ Category UnitConverter::StringToCategory(wstring_view w)
|
||||||
assert(tokenList.size() == EXPECTEDSERIALIZEDCATEGORYTOKENCOUNT);
|
assert(tokenList.size() == EXPECTEDSERIALIZEDCATEGORYTOKENCOUNT);
|
||||||
Category serializedCategory;
|
Category serializedCategory;
|
||||||
serializedCategory.id = wcstol(Unquote(tokenList[0]).c_str(), nullptr, 10);
|
serializedCategory.id = wcstol(Unquote(tokenList[0]).c_str(), nullptr, 10);
|
||||||
serializedCategory.supportsNegative = (tokenList[1].compare(L"1") == 0);
|
serializedCategory.supportsNegative = (tokenList[1] == L"1");
|
||||||
serializedCategory.name = Unquote(tokenList[2]);
|
serializedCategory.name = Unquote(tokenList[2]);
|
||||||
return serializedCategory;
|
return serializedCategory;
|
||||||
}
|
}
|
||||||
|
@ -896,7 +896,7 @@ void UnitConverter::Calculate()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int currentNumberSignificantDigits = GetNumberDigits(m_currentDisplay);
|
int currentNumberSignificantDigits = GetNumberDigits(m_currentDisplay);
|
||||||
int precision = 0;
|
int precision;
|
||||||
if (abs(returnValue) < OPTIMALDECIMALALLOWED)
|
if (abs(returnValue) < OPTIMALDECIMALALLOWED)
|
||||||
{
|
{
|
||||||
precision = MAXIMUMDIGITSALLOWED;
|
precision = MAXIMUMDIGITSALLOWED;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue