CSharp examples for System:Int32
Bit Count UInt 32 (method 2)
using System;// www . j av a 2s.com public class Main{ public static int BitCount2( UInt32 n ) { n = n - ((n >> 1) & 0xDB6DB6DB) - ((n >> 2) & 0x49249249); return (int)( ( n + ( n >> 3 ) ) & 0xC71C71C7 ) % 63; } }