mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-14 17:00:17 +00:00
22 lines
488 B
C#
22 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>());
|
|
}
|
|
}
|
|
}
|