# evm_clz

Counts zero bits from bit 255, the most significant bit, toward bit 0 in a 256-bit unsigned EVM word. Returns 256 for zero. NULL input propagates to NULL.

Canonical HTML: <https://determica.com/docs/functions/evm_clz>

- Kind: scalar function
- Category: [EVM utilities](/docs/category/evm-utilities.md)
- Tags: Types, EVM

Counts zero bits from bit 255, the most significant bit, toward bit 0 in a 256-bit unsigned EVM word. Returns 256 for zero. NULL input propagates to NULL.

## Overload 1: evm_clz(UINT256)

```sql
evm_clz(UINT256)
```

Returns the UINT256 leading-zero count as BIGINT.

- Kind: scalar
- Execution context: Offline
- Behavior: Transform
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `x` (UINT256; required; positional) — UINT256 word to scan from its most significant bit.

### Returns

Leading-zero count

BIGINT in the inclusive range 0 through 256, or NULL for NULL input.

- `leading_zeros` (BIGINT)

Leading-zero count. BIGINT in the inclusive range 0 through 256, or NULL for NULL input.

### Examples

_Local SQL · Local_

```sql
SELECT evm_clz(1::UINT256) AS result;
-- => [{"result":255}]
```
