MCPcopy Create free account
hub / github.com/argotorg/solidity / integerType

Method integerType

libsolidity/ast/Types.cpp:1218–1232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1216}
1217
1218IntegerType const* RationalNumberType::integerType() const
1219{
1220 solAssert(!isFractional(), "integerType() called for fractional number.");
1221 bigint value = m_value.numerator();
1222 bool negative = (value < 0);
1223 if (negative) // convert to positive number of same bit requirements
1224 value = ((0 - value) - 1) << 1;
1225 if (value > u256(-1))
1226 return nullptr;
1227 else
1228 return TypeProvider::integer(
1229 std::max(numberEncodingSize(value), 1u) * 8,
1230 negative ? IntegerType::Modifier::Signed : IntegerType::Modifier::Unsigned
1231 );
1232}
1233
1234FixedPointType const* RationalNumberType::fixedPointType() const
1235{

Callers 5

binaryOperatorResultMethod · 0.80
convertTypeMethod · 0.80
visitMethod · 0.80

Calls 1

numberEncodingSizeFunction · 0.85

Tested by

no test coverage detected