-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed: Dependency on Reloaded.Memory
- Loading branch information
Showing
4 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Reloaded.Universal.Redirector/Structures/BlittablePointer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Reloaded.Universal.Redirector.Structures | ||
{ | ||
/// <summary> | ||
/// Blittable single level pointer type that you can use with generic types such as <see cref="RefFixedArrayPtr{TStruct}"/> (to create array of pointers to structs). | ||
/// Requires .NET Core 3/Standard 2.1 to make good use of. | ||
/// Relevant issue: https://github.com/dotnet/csharplang/issues/1744 | ||
/// </summary> | ||
public unsafe struct BlittablePointer<T> where T : unmanaged | ||
{ | ||
/// <summary> | ||
/// The pointer to the value. | ||
/// </summary> | ||
public T* Pointer { get; set; } | ||
|
||
/// <summary> | ||
/// Creates a blittable pointer | ||
/// </summary> | ||
/// <param name="pointer"></param> | ||
public BlittablePointer(T* pointer) => Pointer = pointer; | ||
|
||
/// <summary/> | ||
public static implicit operator BlittablePointer<T>(T* operand) => new BlittablePointer<T>(operand); | ||
|
||
/// <summary/> | ||
public static implicit operator T*(BlittablePointer<T> operand) => operand.Pointer; | ||
} | ||
} |