Different bits
Find the amount of differing bits between int a and int b.
Assumption: Both integers are positive
XOR the two numbers to expose differing bits
Shift and compare each element against 1 to count
Last updated
Was this helpful?
Find the amount of differing bits between int a and int b.
Assumption: Both integers are positive
XOR the two numbers to expose differing bits
Shift and compare each element against 1 to count
Last updated
Was this helpful?