hlsf wrong slicing solving

This commit is contained in:
Youmu Liu
2025-11-26 20:52:12 +08:00
parent 23914f05ac
commit 83537c7be7
9 changed files with 108 additions and 172 deletions
@@ -47,12 +47,18 @@ namespace StgSharp.HighPerformance.Memory
EntryHandle = handle;
Pointer = (byte*)handle->Position;
AllocSize = s;
// Console.WriteLine($"{(ulong)handle->PreviousNear}<->{(ulong)handle->NextNear},\t{handle->Size}");
}
public readonly ref byte this[int index]
public readonly ref byte this[uint index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ref Pointer[index];
get
{
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual<uint>(index, AllocSize);
return ref Pointer[index];
}
}
public readonly byte* Pointer { get; init; }
@@ -73,7 +79,7 @@ namespace StgSharp.HighPerformance.Memory
private HybridLayerSegregatedFitAllocationHandle _handle;
private int _index = -1;
private uint _index = ~0u;
internal Enumerator(HybridLayerSegregatedFitAllocationHandle span)
{