evm_signextend

Implements EVM SIGNEXTEND. Byte k is indexed from the least significant byte; bit 8*k+7 is copied through all higher bits. SQL BIGINT k values below 0 or at least 31 return the unchanged UINT256 word. NULL input propagates to NULL.

Example

Local

1
SELECT evm_signextend(0::BIGINT, '0x80'::UINT256)::VARCHAR AS result;
2
-- => [{"result":"115792089237316195423570985008687907853269984665640564039457584007913129639808"}]
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

evm_signextend(BIGINT, UINT256) #

Sign-extends the low k+1 bytes of a UINT256 EVM word.

Inputs

Name Type Use
k BIGINT

BIGINT index from the least significant byte.

required positional
x UINT256

UINT256 word to sign-extend.

required positional

Returns

Name Type
result UINT256

Sign-extended word. UINT256 word with high bits filled from bit 8*k+7, or NULL for NULL input.

Category and tags

Category
EVM utilities
Tag
Types
Tag
EVM