Handle.cs
 1  using Ryujinx.Graphics.GAL;
 2  using System.Diagnostics;
 3  using System.Runtime.CompilerServices;
 4  
 5  namespace Ryujinx.Graphics.OpenGL
 6  {
 7      static class Handle
 8      {
 9          public static T FromInt32<T>(int handle) where T : unmanaged
10          {
11              Debug.Assert(Unsafe.SizeOf<T>() == sizeof(ulong));
12  
13              ulong handle64 = (uint)handle;
14  
15              return Unsafe.As<ulong, T>(ref handle64);
16          }
17  
18          public static int ToInt32(this BufferHandle handle)
19          {
20              return (int)Unsafe.As<BufferHandle, ulong>(ref handle);
21          }
22      }
23  }