Posted on

Hamming weight

Hamming weight

https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel

int NumberOfSetBits(int i)
{
i = i - ((i >>> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
return (((i + (i >>> 4)) & 0x0F0F0F0F) * 0x01010101) >>> 24;
}

https://habrahabr.ru/post/276957/

zip

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.