mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix 'ambiguous overload for operator==' Boost error.
This commit is contained in:
parent
797e05ba08
commit
fe8d09a3c1
@ -650,12 +650,12 @@ bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
|||||||
if (_convertTo.category() == Category::Integer)
|
if (_convertTo.category() == Category::Integer)
|
||||||
{
|
{
|
||||||
auto targetType = dynamic_cast<IntegerType const*>(&_convertTo);
|
auto targetType = dynamic_cast<IntegerType const*>(&_convertTo);
|
||||||
if (m_value == 0)
|
if (m_value == rational(0))
|
||||||
return true;
|
return true;
|
||||||
if (isFractional())
|
if (isFractional())
|
||||||
return false;
|
return false;
|
||||||
int forSignBit = (targetType->isSigned() ? 1 : 0);
|
int forSignBit = (targetType->isSigned() ? 1 : 0);
|
||||||
if (m_value > 0)
|
if (m_value > rational(0))
|
||||||
{
|
{
|
||||||
if (m_value.numerator() <= (u256(-1) >> (256 - targetType->numBits() + forSignBit)))
|
if (m_value.numerator() <= (u256(-1) >> (256 - targetType->numBits() + forSignBit)))
|
||||||
return true;
|
return true;
|
||||||
@ -776,13 +776,13 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ
|
|||||||
value = m_value * other.m_value;
|
value = m_value * other.m_value;
|
||||||
break;
|
break;
|
||||||
case Token::Div:
|
case Token::Div:
|
||||||
if (other.m_value == 0)
|
if (other.m_value == rational(0))
|
||||||
return TypePointer();
|
return TypePointer();
|
||||||
else
|
else
|
||||||
value = m_value / other.m_value;
|
value = m_value / other.m_value;
|
||||||
break;
|
break;
|
||||||
case Token::Mod:
|
case Token::Mod:
|
||||||
if (other.m_value == 0)
|
if (other.m_value == rational(0))
|
||||||
return TypePointer();
|
return TypePointer();
|
||||||
else if (fractional)
|
else if (fractional)
|
||||||
{
|
{
|
||||||
@ -887,7 +887,7 @@ u256 RationalNumberType::literalValue(Literal const*) const
|
|||||||
solAssert(shiftedValue <= u256(-1), "Integer constant too large.");
|
solAssert(shiftedValue <= u256(-1), "Integer constant too large.");
|
||||||
solAssert(shiftedValue >= -(bigint(1) << 255), "Number constant too small.");
|
solAssert(shiftedValue >= -(bigint(1) << 255), "Number constant too small.");
|
||||||
|
|
||||||
if (m_value >= 0)
|
if (m_value >= rational(0))
|
||||||
value = u256(shiftedValue);
|
value = u256(shiftedValue);
|
||||||
else
|
else
|
||||||
value = s2u(s256(shiftedValue));
|
value = s2u(s256(shiftedValue));
|
||||||
|
Loading…
Reference in New Issue
Block a user