{
  "id": 7939,
  "title": "EIP-7939: Count leading zeros (CLZ) opcode",
  "status": "Final",
  "type": "Standards Track",
  "category": "Core",
  "summary": "This adds a new CLZ (Count Leading Zeros) opcode to the EVM that efficiently counts the number of zero bits at the start of a 256-bit number. This is a fundamental mathematical operation used in many algorithms, especially for mathematical computations, data compression, and cryptographic operations. Currently, implementing this operation in Solidity requires complex and expensive code - this opcode makes it much cheaper and faster.",
  "impacts": [
    "Indirect benefits through lower gas costs for applications using mathematical operations, compression algorithms, and advanced cryptographic schemes.",
    "Can implement much more efficient mathematical algorithms, compression schemes, and bitmap operations. Particularly beneficial for DeFi protocols requiring complex mathematical operations and ZK-proving applications.",
    "Minimal direct impact, though benefits indirectly from more efficient mathematical operations in smart contracts.",
    "Development tools and debuggers need to support the new CLZ opcode, but this is a straightforward addition.",
    "More efficient mathematical operations benefit ZK-proof generation and verification systems, reducing proving costs especially for RISC-V based proving systems.",
    "More efficient computation reduces overall network computational load for mathematical operations.",
    "No direct impact on consensus layer operations as this affects execution layer computational capabilities.",
    "Simple implementation - just need to add the CLZ opcode (0x1e) with proper gas accounting. Benchmarked to have similar computational cost to ADD.",
    "Dramatically reduces gas costs for bit manipulation operations",
    "Enables more efficient mathematical algorithms on-chain",
    "Particularly beneficial for ZK-proving applications",
    "Reduces bytecode size for mathematical operations",
    "Enables efficient compression and decompression algorithms",
    "Essential building block for advanced cryptographic schemes"
  ],
  "discussion_url": "https://ethereum-magicians.org/t/create-a-new-opcode-for-counting-leading-zeros-clz/10805",
  "source_markdown_url": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7939.md",
  "canonical_url": "/latest/eips/7939.json",
  "markdown_url": "/latest/eips/7939.md",
  "citations": [
    {
      "recordId": "eip-7939",
      "artifactPath": "normalized/7939.json",
      "url": "/records/proposal/eip-7939/normalized/7939.json",
      "label": "EIP-7939: Count leading zeros (CLZ) opcode",
      "snippet": "This adds a new CLZ (Count Leading Zeros) opcode to the EVM that efficiently counts the number of zero bits at the start of a 256-bit number. This is a fundamental mathematical operation used in many algorithms, especial"
    }
  ]
}
