qamp/Qrakhen.Qamp.Core/Values/Address.cs

14 lines
474 B
C#

using System.Runtime.InteropServices;
namespace Qrakhen.Qamp.Core.Values;
[StructLayout(LayoutKind.Sequential, Size = sizeof(long))]
public readonly record struct Address(long Value)
{
public static readonly Address Void = new Address(-1);
public override string ToString() => Value < 0 ? "&void" : $"&{Value:x8}";
public static implicit operator long(Address address) => address.Value;
public static implicit operator Address(long value) => new(value);
}