Beispiel #1
0
 /// <summary>Initialise the boolean array.</summary>
 /// <param name="length"></param>
 public BooleanArray(long length)
 {
     pUnitCount = (length + BitsPerUnit - 1) / BitsPerUnit;
     unsafe {
         pUnits = (Unit *)Marshal.AllocHGlobal(new IntPtr(pUnitCount * BytesPerUnit)).ToPointer();
     }
     //pUnits = new Unit[(length + BitsPerUnit - 1) / BitsPerUnit];
     pCount = length;
 }
Beispiel #2
0
            internal Enumerator(BooleanArray array)
            {
                unsafe {
                    Units = array.pUnits;
                }

                BlockIndex = -1;
                BitIndex   = BitsPerUnit;
                Count      = array.Count;
                BlockValue = 0;
            }
Beispiel #3
0
        public void Open(BinaryReader reader, int size)
        {
            this.array = new Unit[size / UnitSize];

            for (int i = 0; i < array.Length; i++)
            {
                this.array[i] = new Unit()
                {
                    Base  = reader.ReadInt32(),
                    Check = reader.ReadUInt32()
                };
            }
        }
Beispiel #4
0
 public unsafe void Open(byte *ptr, int size)
 {
     this.array     = (Unit *)ptr;
     this.TotalSize = size;
 }