Пример #1
0
        public Block(int id, int totalSize, ushort tileSize, IMemoryHighway hw)
        {
            ID         = id;
            TileSize   = tileSize;
            TotalSize  = totalSize;
            TilesCount = totalSize / tileSize;

            if (TotalSize > tileSize && TotalSize % tileSize != 0)
            {
                TilesCount++;
            }
            if (TilesCount == 0)
            {
                TilesCount = 1;
            }

            IsIncoming = true;
            fragment   = hw.AllocFragment(totalSize);
            tileMap    = new BitMask(TilesCount);
        }
Пример #2
0
        public Block(int id, ushort tileSize, MemoryFragment frag)
        {
            ID         = id;
            fragment   = frag;
            TileSize   = tileSize;
            TotalSize  = frag.Length;
            TilesCount = frag.Length / tileSize;

            if (TotalSize > tileSize && frag.Length % tileSize != 0)
            {
                TilesCount++;
            }
            if (TilesCount == 0)
            {
                TilesCount = 1;
            }

            beamLoop = new TaskCompletionSource <bool>();
            tileMap  = new BitMask(TilesCount);
        }