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:
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user