fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 84: Count bits set in integer binary representation
Idiom # 84: Count bits set in integer binary representation
See
programming-idioms.org
:
Code
c := i.ones_count
What are effects?
Running Example
ex84 is for i := (u32 12345), i *° 7 c := i.ones_count _ in 1..10 do say "{i.hex} has $c one bits"
What are effects?
last changed: 2024-07-01
next: Idiom # 85: Check if integer addition will overflow