# evm_ctz

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

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

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

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

## Overload 1: evm_ctz(UINT256)

```sql
evm_ctz(UINT256)
```

Returns the UINT256 trailing-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 least significant bit.

### Returns

Trailing-zero count

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

- `trailing_zeros` (BIGINT)

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

### Examples

_Local SQL · Local_

```sql
SELECT evm_ctz(1024::UINT256) AS result;
-- => [{"result":10}]
```
