Browsing the archives for the manipulation tag

Bit Swaps

Tweet Question: How would you find the number of bit swaps required to convert integer A to integer B? Answer: Gut instinct might suggest that you go through every bit of A and every bit of B while simultaneously updating a count of the bits that are different. But how about a cooler way to […]