5 ms·
I never think of POPCNT because it's not a language primitive in any languages I use. I would do it by storing the product of the counts; divide by the outgoin
by dubya 4y ago
I never think of POPCNT because it's not a language primitive in any languages I use.
I would do it by storing the product of the counts; divide by the outgoing count before decrementing, multiply by the incoming count after incrementing. If the product is one they're all unique. Scaling should be comparable to POPCNT.