From db0ab7f29468def41b561c33c211bd4c2bfb73ef Mon Sep 17 00:00:00 2001 From: Viktor Stojanovic Date: Fri, 7 Aug 2026 23:23:22 +0200 Subject: [PATCH 1/2] Rename count to element count Change elementCount type to nuint --- src/IAllocator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IAllocator.cs b/src/IAllocator.cs index e8c32a5..85f610a 100644 --- a/src/IAllocator.cs +++ b/src/IAllocator.cs @@ -5,7 +5,7 @@ namespace SharpAllocators; public unsafe interface IAllocator { - public T* Allocate(long count) where T : unmanaged; + public T* Allocate(nuint elementCount) where T : unmanaged; public void Free(T* pointer) where T : unmanaged; - public T* Reallocate(T* pointer, long count) where T : unmanaged; + public T* Reallocate(T* pointer, nuint elementCount) where T : unmanaged; } \ No newline at end of file From cc84811e5f2764beadfb7b9147fcf2d8c5d36390 Mon Sep 17 00:00:00 2001 From: Viktor Stojanovic Date: Fri, 7 Aug 2026 23:25:14 +0200 Subject: [PATCH 2/2] Rename count to element count Change elementCount type to nuint --- src/NativeAllocator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NativeAllocator.cs b/src/NativeAllocator.cs index d58ab0f..fb2327d 100644 --- a/src/NativeAllocator.cs +++ b/src/NativeAllocator.cs @@ -9,9 +9,9 @@ namespace SharpAllocators; public readonly unsafe struct NativeAllocator : IAllocator { [MethodImpl(MethodImplOptions.AggressiveInlining)] - public T* Allocate(long count) where T : unmanaged + public T* Allocate(nuint elementCount) where T : unmanaged { - return (T*)NativeMemory.Alloc((nuint)(count * sizeof(T))); + return (T*)NativeMemory.Alloc(elementCount * (nuint)sizeof(T)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -21,8 +21,8 @@ public void Free(T* pointer) where T : unmanaged } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public T* Reallocate(T* pointer, long count) where T : unmanaged + public T* Reallocate(T* pointer, nuint elementCount) where T : unmanaged { - return (T*)NativeMemory.Realloc(pointer, (nuint)count); + return (T*)NativeMemory.Realloc(pointer, elementCount); } }