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

WriteOnes() private method

private WriteOnes ( List list, int index, uint count ) : void
list List
index int
count uint
return void
        private void WriteOnes(List<uint> list, int index, uint count)
        {
            ResizeAsNeeded(list, index);

            int off = index%32;
            int pointer = index >> 5;
            var cc = (int) count;
            int x = 32 - off;

            if (pointer >= list.Count)
                list.Add(0);

            if (cc > x) //current pointer
            {
                list[pointer] |= ((0xffffffff >> off));
                cc -= (32 - off);
            }
            else
            {
                list[pointer] |= ((0xffffffff << cc) >> off);
                cc = 0;
            }

            while (cc >= 32) //full ints
            {
                list.Add(0xffffffff);
                cc -= 32;
            }
            if (cc > 0) //remaining
                list.Add((0xffffffff << (32 - cc)));
        }