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.

Scalar function TypesEVM

Example

Runs locally

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

API reference

evm_shr(BIGINT, UINT256) #

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

Inputs

Name Type Use
shift BIGINT

Non-negative BIGINT bit count.

required positional
x UINT256

UINT256 word shifted toward bit 0.

required positional

Returns

Name Type
result UINT256

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