WriteDouble() public static method

Writes a double-precision number to the stream; supported wire-types: Fixed32, Fixed64
public static WriteDouble ( double value, ProtoWriter writer ) : void
value double
writer ProtoWriter
return void
Ejemplo n.º 1
0
        static void WriteSingle(float value, ProtoWriter writer)

        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            switch (writer.wireType)

            {
            case WireType.Fixed32:

#if FEAT_SAFE
                ProtoWriter.WriteInt32(BitConverter.ToInt32(BitConverter.GetBytes(value), 0), writer);
#else
                ProtoWriter.WriteInt32(*(int *)&value, writer);
#endif

                return;

            case WireType.Fixed64:

                ProtoWriter.WriteDouble((double)value, writer);

                return;

            default:

                throw CreateException(writer);
            }
        }
Ejemplo n.º 2
0
 public static void WriteSingle(float value, ProtoWriter writer)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     ProtoBuf.WireType wireType = writer.wireType;
     if (wireType == ProtoBuf.WireType.Fixed64)
     {
         ProtoWriter.WriteDouble((double)value, writer);
         return;
     }
     if (wireType != ProtoBuf.WireType.Fixed32)
     {
         throw ProtoWriter.CreateException(writer);
     }
     ProtoWriter.WriteInt32(BitConverter.ToInt32(BitConverter.GetBytes(value), 0), writer);
 }
Ejemplo n.º 3
0
        // Token: 0x060034E4 RID: 13540 RVA: 0x00132E38 File Offset: 0x00131238
        public static void WriteSingle(float value, ProtoWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            WireType wireType = writer.wireType;

            if (wireType == WireType.Fixed32)
            {
                ProtoWriter.WriteInt32((int)value, writer);
                return;
            }
            if (wireType != WireType.Fixed64)
            {
                throw ProtoWriter.CreateException(writer);
            }
            ProtoWriter.WriteDouble((double)value, writer);
        }
Ejemplo n.º 4
0
        static void WriteSingle(float value, ProtoWriter writer)
        {
            switch (writer.wireType)
            {
            case WireType.Fixed32:
#if true
                ProtoWriter.WriteInt32(BitConverter.ToInt32(BitConverter.GetBytes(value), 0), writer);
#else
                ProtoWriter.WriteInt32(*(int *)&value, writer);
#endif
                return;

            case WireType.Fixed64:
                ProtoWriter.WriteDouble((double)value, writer);
                return;

            default:
                throw CreateException(writer);
            }
        }
Ejemplo n.º 5
0
        static void WriteSingle(float value, ProtoWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            switch (writer.wireType)
            {
            case WireType.Fixed32:

                ProtoWriter.WriteInt32(*(int *)&value, writer);
                return;

            case WireType.Fixed64:
                ProtoWriter.WriteDouble((double)value, writer);
                return;

            default:
                throw CreateException(writer);
            }
        }