mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2922 from ethereum/asm-bytes-required
Properly calculate bytesRequired for subs
This commit is contained in:
commit
068a593d9c
@ -59,18 +59,18 @@ unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const
|
|||||||
case Tag: // 1 byte for the JUMPDEST
|
case Tag: // 1 byte for the JUMPDEST
|
||||||
return 1;
|
return 1;
|
||||||
case PushString:
|
case PushString:
|
||||||
return 33;
|
return 1 + 32;
|
||||||
case Push:
|
case Push:
|
||||||
return 1 + max<unsigned>(1, dev::bytesRequired(data()));
|
return 1 + max<unsigned>(1, dev::bytesRequired(data()));
|
||||||
case PushSubSize:
|
case PushSubSize:
|
||||||
case PushProgramSize:
|
case PushProgramSize:
|
||||||
return 4; // worst case: a 16MB program
|
return 1 + 4; // worst case: a 16MB program
|
||||||
case PushTag:
|
case PushTag:
|
||||||
case PushData:
|
case PushData:
|
||||||
case PushSub:
|
case PushSub:
|
||||||
return 1 + _addressLength;
|
return 1 + _addressLength;
|
||||||
case PushLibraryAddress:
|
case PushLibraryAddress:
|
||||||
return 21;
|
return 1 + 20;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user