evm_bit_count

Counts set bits in the complete 256-bit unsigned EVM word. Returns 0 for zero and 256 for UINT256_MAX. NULL input propagates to NULL.

Example

Local

1
SELECT evm_bit_count('0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'::UINT256) AS result;
2
-- => [{"result":128}]
Notebook ready in readonly mode.

API reference

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

evm_bit_count(UINT256) #

Returns the population count of a UINT256 value as BIGINT.

Inputs

Name Type Use
x UINT256

UINT256 word whose one bits are counted.

required positional

Returns

Name Type
count BIGINT

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

Category and tags

Category
EVM utilities
Tag
Types
Tag
EVM