hlsf wrong slicing solving

This commit is contained in:
Youmu Liu
2025-11-25 20:39:18 +08:00
parent 7ef57d8f33
commit 5b09160049
16 changed files with 256 additions and 149 deletions
@@ -36,36 +36,31 @@ using Allocator = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAlloca
namespace StgSharp.HighPerformance.Memory
{
public unsafe struct HybridLayerSegregatedFitAllocationHandle
public readonly unsafe struct HybridLayerSegregatedFitAllocationHandle
{
internal readonly byte* BufferPointer;
internal readonly Allocator.Entry* EntryHandle;
public readonly uint AllocSize;
internal HybridLayerSegregatedFitAllocationHandle(Allocator.Entry* handle, uint s)
{
EntryHandle = handle;
BufferPointer = (byte*)handle->Position;
Pointer = (byte*)handle->Position;
AllocSize = s;
}
public readonly ref byte this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ref BufferPointer[index];
get => ref Pointer[index];
}
public readonly byte* Pointer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => BufferPointer;
}
public readonly byte* Pointer { get; init; }
public readonly Span<byte> BufferHandle
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => new((byte*) EntryHandle->Position, (int)AllocSize);
get => new(Pointer, (int)AllocSize);
}
public readonly Enumerator GetEnumerator()