public static void HalfToUInt16Bits() { Half input = (Half)12.34; ushort result = BitConverter.HalfToUInt16Bits(input); Assert.Equal((ushort)18988, result); Half roundtripped = BitConverter.UInt16BitsToHalf(result); Assert.Equal(input, roundtripped); }
// TODO: Move this directly into EndianBinaryReader private static float ReadHalf(EndianBinaryReader er) => (float)BitConverter.UInt16BitsToHalf(er.ReadUInt16());