Edit

Share via


bitset_count_ones()

Switch services using the Version drop-down list. Learn more about navigation.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel

Performs a bitwise operation on the binary representation of a number.

Syntax

bitset_count_ones(value)

Learn more about syntax conventions.

Parameters

Name Type Required Description
value int ✔️ The value for which to calculate the number of set bits.

Returns

Returns the number of set bits in the binary representation of a number.

Examples

// 42 = 32+8+2 : b'00101010' == 3 bits set
print ones = bitset_count_ones(42) 

Output

ones
3