Yea.Compression.BitArrayCompress.CountOnes C# (CSharp) Method

CountOnes() public method

public CountOnes ( ) : long
return long
        public long CountOnes()
        {
            if (_usingIndexes)
            {
                return _offsets.Count;
            }

            long c = 0;
            CheckBitArray();

            foreach (var i in _uncompressed)
            {
                if (i != 0)
                {
                    uint m = 1;
                    for (int j = 0; j < 32; j++)
                    {
                        uint o = i & m;
                        if (o != 0)
                            c++;
                        m <<= 1;
                    }
                }
            }
            return c;
        }