4 ms·
AND your input with 0xAAAAAAAA (ie 101010...10 binary) to turn all the "11" values into "10".
by andrewf 15y ago
AND your input with 0xAAAAAAAA (ie 101010...10 binary) to turn all the "11" values into "10".
- adgar 15y agoHow does help me use popcnt to find how many bit pairs are used and how many are empty? Edit: whoops, I gotcha. I'll profile this. Edit 2: no I won't profile it, because I don't have the instruction. Damn.
- acqq 15y agoYou don't need to have POPCNT to implement much faster bit counting: http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel http://graphics.stanford.edu/~seander/bithacks.html#CountBit...