This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
station_obscurum_unity/Assets/FishNet/Runtime/Serializing/Helping/ValueConversions.cs

42 lines
813 B
C#

using System.Runtime.InteropServices;
namespace FishNet.Serializing.Helping
{
// -- helpers for float conversion without allocations --
[StructLayout(LayoutKind.Explicit)]
internal struct UIntFloat
{
[FieldOffset(0)]
public float FloatValue;
[FieldOffset(0)]
public uint UIntValue;
}
[StructLayout(LayoutKind.Explicit)]
internal struct UIntDouble
{
[FieldOffset(0)]
public double DoubleValue;
[FieldOffset(0)]
public ulong LongValue;
}
[StructLayout(LayoutKind.Explicit)]
internal struct UIntDecimal
{
[FieldOffset(0)]
public ulong LongValue1;
[FieldOffset(8)]
public ulong LongValue2;
[FieldOffset(0)]
public decimal DecimalValue;
}
}