aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/CompilerUtils.cpp
diff options
context:
space:
mode:
authorhydai <z54981220@gmail.com>2018-11-29 16:34:17 +0800
committerhydai <z54981220@gmail.com>2018-11-29 17:07:18 +0800
commit9326adc3db513353da51d9732d1c92b33ecd4d16 (patch)
treeacc49affdc911984d67a37fe7e61c8bc4bca94c6 /libsolidity/codegen/CompilerUtils.cpp
parentb4086ac87037813eb553e92839bbc40de6bbd9ac (diff)
downloaddexon-solidity-9326adc3db513353da51d9732d1c92b33ecd4d16.tar.gz
dexon-solidity-9326adc3db513353da51d9732d1c92b33ecd4d16.tar.zst
dexon-solidity-9326adc3db513353da51d9732d1c92b33ecd4d16.zip
Replace IntegerType(256) with static function IntegerType::uint256()
Diffstat (limited to 'libsolidity/codegen/CompilerUtils.cpp')
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index 93c8cc77..7d2ad9d2 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -136,7 +136,7 @@ void CompilerUtils::loadFromMemoryDynamic(
void CompilerUtils::storeInMemory(unsigned _offset)
{
- unsigned numBytes = prepareMemoryStore(IntegerType(256), true);
+ unsigned numBytes = prepareMemoryStore(IntegerType::uint256(), true);
if (numBytes > 0)
m_context << u256(_offset) << Instruction::MSTORE;
}
@@ -150,7 +150,7 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound
ref->location() == DataLocation::Memory,
"Only in-memory reference type can be stored."
);
- storeInMemoryDynamic(IntegerType(256), _padToWordBoundaries);
+ storeInMemoryDynamic(IntegerType::uint256(), _padToWordBoundaries);
}
else if (auto str = dynamic_cast<StringLiteralType const*>(&_type))
{
@@ -266,7 +266,7 @@ void CompilerUtils::abiDecode(TypePointers const& _typeParameters, bool _fromMem
if (calldataType->isDynamicallySized())
{
// put on stack: data_pointer length
- loadFromMemoryDynamic(IntegerType(256), !_fromMemory);
+ loadFromMemoryDynamic(IntegerType::uint256(), !_fromMemory);
m_context << Instruction::SWAP1;
// stack: input_end base_offset next_pointer data_offset
m_context.appendInlineAssembly("{ if gt(data_offset, 0x100000000) { revert(0, 0) } }", {"data_offset"});
@@ -277,7 +277,7 @@ void CompilerUtils::abiDecode(TypePointers const& _typeParameters, bool _fromMem
{"input_end", "base_offset", "next_ptr", "array_head_ptr"}
);
// retrieve length
- loadFromMemoryDynamic(IntegerType(256), !_fromMemory, true);
+ loadFromMemoryDynamic(IntegerType::uint256(), !_fromMemory, true);
// stack: input_end base_offset next_pointer array_length data_pointer
m_context << Instruction::SWAP2;
// stack: input_end base_offset data_pointer array_length next_pointer
@@ -430,7 +430,7 @@ void CompilerUtils::encodeToMemory(
{
auto const& strType = dynamic_cast<StringLiteralType const&>(*_givenTypes[i]);
m_context << u256(strType.value().size());
- storeInMemoryDynamic(IntegerType(256), true);
+ storeInMemoryDynamic(IntegerType::uint256(), true);
// stack: ... <end_of_mem'>
storeInMemoryDynamic(strType, _padToWordBoundaries);
}
@@ -445,7 +445,7 @@ void CompilerUtils::encodeToMemory(
m_context << dupInstruction(1 + arrayType.sizeOnStack());
ArrayUtils(m_context).retrieveLength(arrayType, 1);
// stack: ... <end_of_mem> <value...> <end_of_mem'> <length>
- storeInMemoryDynamic(IntegerType(256), true);
+ storeInMemoryDynamic(IntegerType::uint256(), true);
// stack: ... <end_of_mem> <value...> <end_of_mem''>
// copy the new memory pointer
m_context << swapInstruction(arrayType.sizeOnStack() + 1) << Instruction::POP;
@@ -807,7 +807,7 @@ void CompilerUtils::convertType(
allocateMemory();
// stack: mempos
m_context << Instruction::DUP1 << u256(data.size());
- storeInMemoryDynamic(IntegerType(256));
+ storeInMemoryDynamic(IntegerType::uint256());
// stack: mempos datapos
storeStringData(data);
}
@@ -856,7 +856,7 @@ void CompilerUtils::convertType(
if (targetType.isDynamicallySized())
{
m_context << Instruction::DUP2;
- storeInMemoryDynamic(IntegerType(256));
+ storeInMemoryDynamic(IntegerType::uint256());
}
// stack: <mem start> <source ref> (variably sized) <length> <mem data pos>
if (targetType.baseType()->isValueType())
@@ -1210,7 +1210,7 @@ void CompilerUtils::storeStringData(bytesConstRef _data)
for (unsigned i = 0; i < _data.size(); i += 32)
{
m_context << h256::Arith(h256(_data.cropped(i), h256::AlignLeft));
- storeInMemoryDynamic(IntegerType(256));
+ storeInMemoryDynamic(IntegerType::uint256());
}
m_context << Instruction::POP;
}