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.

Scalar function TypesEVM

Example

Runs locally

SELECT evm_bit_count('0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'::UINT256) AS result;
-- => [{"result":128}]

API reference

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.