mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
core/vm: simplify op lookup in contract (#23974)
This commit is contained in:
parent
f7c6b1abd4
commit
6415934da9
1 changed files with 2 additions and 7 deletions
|
|
@ -132,16 +132,11 @@ func (c *Contract) AsDelegate() *Contract {
|
||||||
|
|
||||||
// GetOp returns the n'th element in the contract's byte array
|
// GetOp returns the n'th element in the contract's byte array
|
||||||
func (c *Contract) GetOp(n uint64) OpCode {
|
func (c *Contract) GetOp(n uint64) OpCode {
|
||||||
return OpCode(c.GetByte(n))
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetByte returns the n'th byte in the contract's byte array
|
|
||||||
func (c *Contract) GetByte(n uint64) byte {
|
|
||||||
if n < uint64(len(c.Code)) {
|
if n < uint64(len(c.Code)) {
|
||||||
return c.Code[n]
|
return OpCode(c.Code[n])
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return STOP
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caller returns the caller of the contract.
|
// Caller returns the caller of the contract.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue