mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-08-30 07:25:05 +00:00
14 lines
376 B
C#
14 lines
376 B
C#
using System.IO;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Ryujinx.Common
|
|
{
|
|
public static class BinaryReaderExtensions
|
|
{
|
|
public static T ReadStruct<T>(this BinaryReader reader) where T : unmanaged
|
|
{
|
|
return MemoryMarshal.Cast<byte, T>(reader.ReadBytes(Unsafe.SizeOf<T>()))[0];
|
|
}
|
|
}
|
|
}
|