示例#1
0
        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);
        }
示例#2
0
// TODO: Move this directly into EndianBinaryReader
        private static float ReadHalf(EndianBinaryReader er)
        => (float)BitConverter.UInt16BitsToHalf(er.ReadUInt16());