示例#1
0
        public static void WriteBigEndian(this IBufferWriter <byte> writer, float value)
        {
            var size = sizeof(int);
            var span = writer.GetSpan(size);

            BinaryPrimitiveEx.WriteSingleBigEndian(span, value);
            writer.Advance(size);
        }
示例#2
0
        public static void WriteBigEndian(this IBufferWriter <byte> writer, double value)
        {
            var size = sizeof(long);
            var span = writer.GetSpan(size);

            BinaryPrimitiveEx.WriteDoubleBigEndian(span, value);
            writer.Advance(size);
        }
 /// <summary>
 /// 读取float
 /// </summary>
 /// <param name="value"></param>
 public void ReadBigEndian(out float value)
 {
     value     = BinaryPrimitiveEx.ReadSingleBigEndian(this.span);
     this.span = this.span.Slice(sizeof(int));
 }
 /// <summary>
 /// 读取double
 /// </summary>
 /// <param name="value"></param>
 public void ReadBigEndian(out double value)
 {
     value     = BinaryPrimitiveEx.ReadDoubleBigEndian(this.span);
     this.span = this.span.Slice(sizeof(long));
 }