MathLib::intsuffix: Added support for LLU and LU suffixes.

This commit is contained in:
Martin Ettl 2015-06-16 19:12:18 +02:00
parent 227b48212e
commit 9b14ab15eb
3 changed files with 21 additions and 5 deletions

View File

@ -547,11 +547,13 @@ static std::string intsuffix(const std::string & first, const std::string & seco
suffix2 = c + suffix2;
}
if (suffix1 == "ULL" || suffix2 == "ULL")
if (suffix1 == "ULL" || suffix2 == "ULL"
|| suffix1 == "LLU" || suffix2 == "LLU")
return "ULL";
if (suffix1 == "LL" || suffix2 == "LL")
return "LL";
if (suffix1 == "UL" || suffix2 == "UL")
if (suffix1 == "UL" || suffix2 == "UL"
|| suffix1 == "LU" || suffix2 == "LU")
return "UL";
if (suffix1 == "L" || suffix2 == "L")
return "L";

View File

@ -189,6 +189,13 @@ private:
ASSERT_EQUALS("2LL", MathLib::add("1LL", "1UL"));
ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1UL"));
ASSERT_EQUALS("2UL", MathLib::add("1", "1LU"));
ASSERT_EQUALS("2UL", MathLib::add("1U", "1LU"));
ASSERT_EQUALS("2UL", MathLib::add("1L", "1LU"));
ASSERT_EQUALS("2UL", MathLib::add("1UL", "1LU"));
ASSERT_EQUALS("2LL", MathLib::add("1LL", "1LU"));
ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1LU"));
ASSERT_EQUALS("2LL", MathLib::add("1", "1LL"));
ASSERT_EQUALS("2LL", MathLib::add("1U", "1LL"));
ASSERT_EQUALS("2LL", MathLib::add("1L", "1LL"));
@ -202,6 +209,13 @@ private:
ASSERT_EQUALS("2ULL", MathLib::add("1UL", "1ULL"));
ASSERT_EQUALS("2ULL", MathLib::add("1LL", "1ULL"));
ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1ULL"));
ASSERT_EQUALS("2ULL", MathLib::add("1", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1U", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1L", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1UL", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1LL", "1LLU"));
ASSERT_EQUALS("2ULL", MathLib::add("1ULL", "1LLU"));
}
void convert() const {