Skip to content

Conversation

@anvacaru
Copy link
Contributor

blocked on: #2823

Implementing the CLZ (Counting Leading Zeros) opcode introduced in EIP-7939.

The opcode returns the number of leading zeros in an evm word. There is a special case for 0, in which the returned value is 256. It has a gas cost of five, similar to the other Wlow opcodes, and is available from the Osaka schedule onwards.

To compute the number of leading zeros of a number, we use the log2Int K builtin, as it returns the index of the highest set bit, which we then subtract from 255.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants