public TestHeap(int size) { _allocator = new RangeAllocator <TestAllocation>(size); _allocator.MoveListener = this; _buffer = new byte[size]; }
object RangeAllocator <TestAllocation> .IMoveListener.Save(RangeAllocator <TestAllocation> .Range entry) { var save = new byte[entry.Size]; Buffer.BlockCopy(_buffer, entry.Position, save, 0, entry.Size); return(save); }
public void Compile(IFileSystem fileSystem) { var allocator = new RangeAllocator(RomConfig.FreeRanges); var outputRomData = new Block(RomData); var compiler = Compiler.Create(outputRomData, allocator, Modules); compiler.Compile(); var binaryManager = new BinaryFileManager(fileSystem); binaryManager.WriteFile(ProjectSettings.OutputRomPath, outputRomData); }
void RangeAllocator <TestAllocation> .IMoveListener.Move(RangeAllocator <TestAllocation> .Range entry, int newPosition) { Debug.Assert(entry.Position == entry.User.position); Buffer.BlockCopy(_buffer, entry.Position, _buffer, newPosition, entry.Size); entry.User.position = newPosition; }
void RangeAllocator <TestAllocation> .IMoveListener.Load(RangeAllocator <TestAllocation> .Range entry, object data) { Buffer.BlockCopy((byte[])data, 0, _buffer, entry.Position, entry.Size); }