misc: Replace references to IntPtr/UIntPtr with nint/nuint + code cleanups.

This commit is contained in:
Evan Husted
2024-10-26 08:46:41 -05:00
parent a09d314817
commit dfb4854d19
172 changed files with 902 additions and 914 deletions

View File

@@ -29,7 +29,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
private readonly unsafe ref MemoryPoolState MemoryPoolState => ref *_memoryPools;
public readonly unsafe bool HasMemoryPoolState => (IntPtr)_memoryPools != IntPtr.Zero;
public readonly unsafe bool HasMemoryPoolState => (nint)_memoryPools != nint.Zero;
/// <summary>
/// Create an new empty <see cref="AddressInfo"/>.

View File

@@ -55,7 +55,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
[MarshalAs(UnmanagedType.I1)]
public bool IsUsed;
public static unsafe MemoryPoolState* Null => (MemoryPoolState*)IntPtr.Zero.ToPointer();
public static unsafe MemoryPoolState* Null => (MemoryPoolState*)nint.Zero.ToPointer();
/// <summary>
/// Create a new <see cref="MemoryPoolState"/> with the given <see cref="LocationType"/>.

View File

@@ -65,7 +65,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
/// <summary>
/// The effect processing order storage.
/// </summary>
private readonly IntPtr _effectProcessingOrderArrayPointer;
private readonly nint _effectProcessingOrderArrayPointer;
/// <summary>
/// The max element count that can be found in the effect processing order storage.
@@ -123,7 +123,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
{
get
{
if (_effectProcessingOrderArrayPointer == IntPtr.Zero)
if (_effectProcessingOrderArrayPointer == nint.Zero)
{
return Span<int>.Empty;
}
@@ -153,7 +153,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
unsafe
{
// SAFETY: safe as effectProcessingOrderArray comes from the work buffer memory that is pinned.
_effectProcessingOrderArrayPointer = (IntPtr)Unsafe.AsPointer(ref MemoryMarshal.GetReference(effectProcessingOrderArray.Span));
_effectProcessingOrderArrayPointer = (nint)Unsafe.AsPointer(ref MemoryMarshal.GetReference(effectProcessingOrderArray.Span));
}
EffectProcessingOrderArrayMaxCount = (uint)effectProcessingOrderArray.Length;