Capy-Bearer Documentation

bit_count_lz

lib call

Capy

function bit_count_lz(value : s8) s64
function bit_count_lz(value : s16) s64
function bit_count_lz(value : s32) s64
function bit_count_lz(value : s64) s64
function bit_count_lz(value : u8) s64
function bit_count_lz(value : u16) s64
function bit_count_lz(value : u32) s64
function bit_count_lz(value : u64) s64

Description

width - bit_count_lz(value) is the number of significant bits, which gives the position of the highest set bit.

Parameters

value : an integer

Return Values

The number of zero bits above the highest one bit, as s64. A zero input yields the type width.

Example

Capy

print(bit_count_lz(u8(1)), " ", bit_count_lz(u32(0)), " ", 64 - bit_count_lz(1024), "\n")

Output

7 32 11