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

Method prepareMemoryStore

libsolidity/codegen/CompilerUtils.cpp:1634–1663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1632}
1633
1634unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWords, bool _cleanup)
1635{
1636 solAssert(
1637 _type.sizeOnStack() == 1,
1638 "Memory store of types with stack size != 1 not allowed (Type: " + _type.toString(true) + ")."
1639 );
1640
1641 solAssert(!_type.isDynamicallyEncoded());
1642
1643 unsigned numBytes = _type.calldataEncodedSize(_padToWords);
1644
1645 solAssert(
1646 numBytes > 0,
1647 "Memory store of 0 bytes requested (Type: " + _type.toString(true) + ")."
1648 );
1649
1650 solAssert(
1651 numBytes <= 32,
1652 "Memory store of more than 32 bytes requested (Type: " + _type.toString(true) + ")."
1653 );
1654
1655 if (_cleanup)
1656 convertType(_type, _type, true);
1657
1658 if (numBytes != 32 && !_type.leftAligned() && !_padToWords)
1659 // shift the value accordingly before storing
1660 leftShiftNumberOnStack((32 - numBytes) * 8);
1661
1662 return numBytes;
1663}

Callers

nothing calls this directly

Calls 6

convertTypeFunction · 0.85
sizeOnStackMethod · 0.45
toStringMethod · 0.45
isDynamicallyEncodedMethod · 0.45
calldataEncodedSizeMethod · 0.45
leftAlignedMethod · 0.45

Tested by

no test coverage detected