aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio/Native/libsoundio/MarshalExtensions.cs
blob: ec3eef3757e20dd7dd2de7beb622889fa39d4604 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using System.Runtime.InteropServices;

namespace SoundIOSharp
{
	public static class MarshalEx
	{
		public static double ReadDouble (IntPtr handle, int offset = 0)
		{
			return BitConverter.Int64BitsToDouble (Marshal.ReadInt64 (handle, offset));
		}

		public static void WriteDouble (IntPtr handle, double value)
		{
			WriteDouble (handle, 0, value);
		}

		public static void WriteDouble (IntPtr handle, int offset, double value)
		{
			Marshal.WriteInt64 (handle, offset, BitConverter.DoubleToInt64Bits (value));
		}
	}
}