Skip to main content
added 4 characters in body
Source Link
bart1e
  • 3.4k
  • 2
  • 8
  • 25

It counts the number of 1's1's in argument'sargument's binary representation (see link).

Basically, each n & (n - 1) cancels out the least significant 1 in n's binary representation, preserving all more significant digits.

It counts the number of 1's in argument's binary representation (see link).

It counts the number of 1's in argument's binary representation (see link).

Basically, each n & (n - 1) cancels out the least significant 1 in n's binary representation, preserving all more significant digits.

Source Link
bart1e
  • 3.4k
  • 2
  • 8
  • 25

It counts the number of 1's in argument's binary representation (see link).