문제

Is there a method similar to Java's Integer.bitCount(int) or Long.bitCount(long) anywhere in the .NET Framework?

(For those unfamiliar with these Java methods) this is also known as:

  • Hamming Weight
  • Population Count (often called POPCNT when implemented in hardware.)

Although there are plenty of implementations to be found on the web, I was wondering if there was a standard library implementation.

I know this is not in BitArray, UInt32 or BitConverter, but maybe there's a version hidden somewhere, e.g. in a crypto function.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top