bitset_count_ones()
Returns the number of set bits in 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.
Example
// 42 = 32+8+2 : b'00101010' == 3 bits set
print ones = bitset_count_ones(42)
Output
ones |
---|
3 |
Pripomienky
https://aka.ms/ContentUserFeedback.
Pripravujeme: V priebehu roka 2024 postupne zrušíme službu Problémy v službe GitHub ako mechanizmus pripomienok týkajúcich sa obsahu a nahradíme ju novým systémom pripomienok. Ďalšie informácie nájdete na stránke:Odoslať a zobraziť pripomienky pre