aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/CompilerUtils.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-12-08 23:15:35 +0800
committerGitHub <noreply@github.com>2016-12-08 23:15:35 +0800
commit84443eb56022cdb236425b99e253d0b142261372 (patch)
tree4521cefe6c045373644c20b485c0b31c2ee9edd5 /libsolidity/codegen/CompilerUtils.cpp
parente7ff4ac810a44cf3bfd58ee4ff198f136f011e2d (diff)
parente7760417e83cf9e313c76cdd44f860aeec1b798c (diff)
downloaddexon-solidity-84443eb56022cdb236425b99e253d0b142261372.tar.gz
dexon-solidity-84443eb56022cdb236425b99e253d0b142261372.tar.zst
dexon-solidity-84443eb56022cdb236425b99e253d0b142261372.zip
Merge pull request #1351 from ethereum/truncate_bit
Truncate a boolean from calldata into one bit
Diffstat (limited to 'libsolidity/codegen/CompilerUtils.cpp')
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index a8299626..7c159ff7 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -926,6 +926,8 @@ unsigned CompilerUtils::loadFromMemoryHelper(Type const& _type, bool _fromCallda
if (leftAligned)
m_context << shiftFactor << Instruction::MUL;
}
+ if (_fromCalldata)
+ convertType(_type, _type, true);
return numBytes;
}
@@ -940,7 +942,7 @@ void CompilerUtils::cleanHigherOrderBits(IntegerType const& _typeOnStack)
m_context << ((u256(1) << _typeOnStack.numBits()) - 1) << Instruction::AND;
}
-unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWordBoundaries) const
+unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWordBoundaries)
{
unsigned numBytes = _type.calldataEncodedSize(_padToWordBoundaries);
bool leftAligned = _type.category() == Type::Category::FixedBytes;
@@ -949,6 +951,7 @@ unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWordBou
else
{
solAssert(numBytes <= 32, "Memory store of more than 32 bytes requested.");
+ convertType(_type, _type, true);
if (numBytes != 32 && !leftAligned && !_padToWordBoundaries)
// shift the value accordingly before storing
m_context << (u256(1) << ((32 - numBytes) * 8)) << Instruction::MUL;