mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-15 06:10:18 +00:00
23 lines
488 B
C#
23 lines
488 B
C#
|
using System;
|
|||
|
using System.Runtime.CompilerServices;
|
|||
|
using System.Runtime.InteropServices;
|
|||
|
|
|||
|
namespace Ryujinx.Horizon.Sdk
|
|||
|
{
|
|||
|
ref struct Writer
|
|||
|
{
|
|||
|
private Span<byte> _output;
|
|||
|
|
|||
|
public Writer(Span<byte> output)
|
|||
|
{
|
|||
|
_output = output;
|
|||
|
}
|
|||
|
|
|||
|
public void Write<T>(T value) where T : unmanaged
|
|||
|
{
|
|||
|
MemoryMarshal.Cast<byte, T>(_output)[0] = value;
|
|||
|
_output = _output.Slice(Unsafe.SizeOf<T>());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|