What is the fastest way to return the positions of all set bits in a 64-bit integer?
I believe the key to performance here is to focus on the larger problem rather than on micro-optimizing the extraction of bit positions out of a random integer. Judging by your sample code and previous SO question you are enumerating all words with K bits set in order, and extracting the bit indices out of … Read more