Fix Sort Line as Integer regression
The regression was made by #5555:
ff20c264df
Close #5843, fix #5839
This commit is contained in:
parent
e9277deaa6
commit
8b151ac991
@ -167,16 +167,7 @@ public:
|
|||||||
// Maximum value for a variable of type unsigned long long | 18446744073709551615
|
// Maximum value for a variable of type unsigned long long | 18446744073709551615
|
||||||
// So take the max length 18 to convert the number
|
// So take the max length 18 to convert the number
|
||||||
const size_t maxLen = 18;
|
const size_t maxLen = 18;
|
||||||
size_t aLen = a.length() - i, bLen = b.length() - i;
|
compareResult = std::stoll(a.substr(i, maxLen)) - std::stoll(b.substr(i, maxLen), &delta);
|
||||||
if (aLen > maxLen || bLen > maxLen)
|
|
||||||
{
|
|
||||||
delta = min(min(aLen, bLen), maxLen);
|
|
||||||
compareResult = std::stoll(a.substr(i, delta)) - std::stoll(b.substr(i, delta));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
compareResult = std::stoll(a.substr(i)) - std::stoll(b.substr(i), &delta);
|
|
||||||
}
|
|
||||||
i += delta;
|
i += delta;
|
||||||
}
|
}
|
||||||
// Both are strings
|
// Both are strings
|
||||||
@ -231,16 +222,7 @@ public:
|
|||||||
// Maximum value for a variable of type unsigned long long | 18446744073709551615
|
// Maximum value for a variable of type unsigned long long | 18446744073709551615
|
||||||
// So take the max length 18 to convert the number
|
// So take the max length 18 to convert the number
|
||||||
const size_t maxLen = 18;
|
const size_t maxLen = 18;
|
||||||
size_t aLen = a.length() - i, bLen = b.length() - i;
|
compareResult = std::stoll(a.substr(i, maxLen)) - std::stoll(b.substr(i, maxLen), &delta);
|
||||||
if (aLen > maxLen || bLen > maxLen)
|
|
||||||
{
|
|
||||||
delta = min(min(aLen, bLen), maxLen);
|
|
||||||
compareResult = std::stoll(a.substr(i, delta)) - std::stoll(b.substr(i, delta));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
compareResult = std::stoll(a.substr(i)) - std::stoll(b.substr(i), &delta);
|
|
||||||
}
|
|
||||||
i += delta;
|
i += delta;
|
||||||
}
|
}
|
||||||
// Both are strings
|
// Both are strings
|
||||||
|
Loading…
Reference in New Issue
Block a user