See also "leading_zeros".

-erik

On Thu, Aug 11, 2016 at 1:52 PM, Tom Breloff <[email protected]> wrote:

> help?> count_ones
> search: count_ones count_zeros
>
>   count_ones(x::Integer) -> Integer
>
>   Number of ones in the binary representation of x.
>
>   julia> count_ones(7)
>   3
>
>
> On Thu, Aug 11, 2016 at 1:48 PM, jw3126 <[email protected]> wrote:
>
>> I have a bitstype and want to know the number of ones in its bit
>> representation as well as the first bit. How to accomplish these in a
>> performant way?
>>
>
>


-- 
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/

Reply via email to