public void Free(int listBlockIndex) { int listEntryIndex = BlockToEntryIndex(listBlockIndex); AllocationTableEntry listEntry = ReadEntry(listEntryIndex); if (!listEntry.IsListStart()) { throw new ArgumentOutOfRangeException(nameof(listBlockIndex), "The block to free must be the start of a list."); } int freeListIndex = GetFreeListEntryIndex(); // Free list is empty if (freeListIndex == 0) { SetFreeListEntryIndex(listEntryIndex); return; } Join(listBlockIndex, EntryIndexToBlock(freeListIndex)); SetFreeListBlockIndex(listBlockIndex); }