Bits counting trick

During my chess AI project (named E85) my team run across the problem of counting the set bits from a long long constant. Of course, counting them in a loop was a solution but it was a slow solution and we wanted to see if there is something more rapid than this, preferably something without using ifs.

Read the rest of this entry »