mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
core/vm: optimize CLZ
This commit is contained in:
parent
81546c64c7
commit
166ad3efe1
1 changed files with 3 additions and 3 deletions
|
|
@ -294,10 +294,10 @@ func opBlobBaseFee(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// opCLZ implements the CLZ opcode (count leading zero bytes)
|
||||||
func opCLZ(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
|
func opCLZ(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
|
||||||
x := scope.Stack.pop()
|
x := scope.Stack.peek()
|
||||||
// count leading zero bits in x
|
x.SetUint64(256 - uint64(x.BitLen()))
|
||||||
scope.Stack.push(new(uint256.Int).SetUint64(256 - uint64(x.BitLen())))
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue