feat(buffer): add TLSF allocator and seqlock primitives

Added a TLSF (Two-Level Segregated Fit) memory allocator with O(1) allocation, free, and reallocation in `TLSF.cs`, plus comprehensive unit tests. Introduced a cache-line-padded `SeqLock` synchronization primitive. Refactored vector extension code for conciseness and fixed its usage to `extension(ref ...)`. Updated namespaces, removed unused code, and improved assertion and diagnostics. Updated NuGet dependencies and project files.
This commit is contained in:
2026-04-06 11:56:08 +09:00
parent d8be2c7b2a
commit 9824c1ed19
13 changed files with 1098 additions and 1967 deletions

View File

@@ -262,6 +262,8 @@ public unsafe struct MemoryBlock : IDisposable
public readonly Span<T> AsSpan<T>(int start, int length)
where T : unmanaged
{
Debug.Assert(_size % (uint)sizeof(T) == 0, "The size of the collection must be a multiple of the size of the element type.");
if (start < 0 || length < 0 || (nuint)(start + length) * (nuint)sizeof(T) > _size)
{
throw new ArgumentOutOfRangeException(nameof(start), "The specified range is out of bounds of the collection.");