# evm_shr

Implements EVM SHR: logically shifts a UINT256 word right, fills high bits with zero, and returns zero for counts at least 256. Negative SQL BIGINT counts throw Invalid Input Error: Shift amount must be non-negative. NULL input propagates to NULL.

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

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

Implements EVM SHR: logically shifts a UINT256 word right, fills high bits with zero, and returns zero for counts at least 256. Negative SQL BIGINT counts throw Invalid Input Error: Shift amount must be non-negative. NULL input propagates to NULL.

## Overload 1: evm_shr(BIGINT, UINT256)

```sql
evm_shr(BIGINT, UINT256)
```

Logical right shift with zero fill over a 256-bit EVM word.

- 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

- `shift` (BIGINT; required; positional) — Non-negative BIGINT bit count.
- `x` (UINT256; required; positional) — UINT256 word shifted toward bit 0.

### Returns

Right-shifted word

UINT256 shifted word, zero for shift >= 256, or NULL for NULL input.

- `result` (UINT256)

Right-shifted word. UINT256 shifted word, zero for shift >= 256, or NULL for NULL input.

### Examples

_Local SQL · Local_

```sql
SELECT evm_shr(4::BIGINT, 256::UINT256)::VARCHAR AS result;
-- => [{"result":"16"}]
```
