misc: chore: Use explicit types in ARMeilleure project

This commit is contained in:
Evan Husted 2025-01-25 14:01:13 -06:00
parent be3bd0bcb5
commit e0567c5ce9
37 changed files with 109 additions and 106 deletions

View file

@ -129,13 +129,13 @@ namespace ARMeilleure.Common
if (count > _count)
{
var oldMask = _masks;
var oldSpan = new Span<long>(_masks, _count);
long* oldMask = _masks;
Span<long> oldSpan = new Span<long>(_masks, _count);
_masks = _allocator.Allocate<long>((uint)count);
_count = count;
var newSpan = new Span<long>(_masks, _count);
Span<long> newSpan = new Span<long>(_masks, _count);
oldSpan.CopyTo(newSpan);
newSpan[oldSpan.Length..].Clear();

View file

@ -63,7 +63,7 @@ namespace ARMeilleure.Common
}
int index = _freeHint++;
var page = GetPage(index);
Span<TEntry> page = GetPage(index);
_allocated.Set(index);
@ -111,7 +111,7 @@ namespace ARMeilleure.Common
throw new ArgumentException("Entry at the specified index was not allocated", nameof(index));
}
var page = GetPage(index);
Span<TEntry> page = GetPage(index);
return ref GetValue(page, index);
}
@ -136,7 +136,7 @@ namespace ARMeilleure.Common
/// <returns>Page for the specified <see cref="index"/></returns>
private unsafe Span<TEntry> GetPage(int index)
{
var pageIndex = (int)((uint)(index & ~(_pageCapacity - 1)) >> _pageLogCapacity);
int pageIndex = (int)((uint)(index & ~(_pageCapacity - 1)) >> _pageLogCapacity);
if (!_pages.TryGetValue(pageIndex, out nint page))
{
@ -168,7 +168,7 @@ namespace ARMeilleure.Common
{
_allocated.Dispose();
foreach (var page in _pages.Values)
foreach (IntPtr page in _pages.Values)
{
NativeAllocator.Instance.Free((void*)page);
}