Refactoring bytesRequired to accept and return size_t

This commit is contained in:
Djordje Mijovic 2020-06-05 14:33:20 +02:00
parent 731b2efc97
commit 9e92fbccee
2 changed files with 3 additions and 3 deletions

View File

@ -59,7 +59,7 @@ void AssemblyItem::setPushTagSubIdAndTag(size_t _subId, size_t _tag)
setData(data); setData(data);
} }
unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const size_t AssemblyItem::bytesRequired(size_t _addressLength) const
{ {
switch (m_type) switch (m_type)
{ {
@ -69,7 +69,7 @@ unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const
case PushString: case PushString:
return 1 + 32; return 1 + 32;
case Push: case Push:
return 1 + max<unsigned>(1, util::bytesRequired(data())); return 1 + max<size_t>(1, util::bytesRequired(data()));
case PushSubSize: case PushSubSize:
case PushProgramSize: case PushProgramSize:
return 1 + 4; // worst case: a 16MB program return 1 + 4; // worst case: a 16MB program

View File

@ -133,7 +133,7 @@ public:
/// @returns an upper bound for the number of bytes required by this item, assuming that /// @returns an upper bound for the number of bytes required by this item, assuming that
/// the value of a jump tag takes @a _addressLength bytes. /// the value of a jump tag takes @a _addressLength bytes.
unsigned bytesRequired(unsigned _addressLength) const; size_t bytesRequired(size_t _addressLength) const;
size_t arguments() const; size_t arguments() const;
size_t returnValues() const; size_t returnValues() const;
size_t deposit() const { return returnValues() - arguments(); } size_t deposit() const { return returnValues() - arguments(); }