WriteUInt64() публичный статический Метод

Writes an unsigned 64-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64
public static WriteUInt64 ( ulong value, ProtoWriter writer ) : void
value ulong
writer ProtoWriter
Результат void
Пример #1
0
        /// <summary>
        /// Writes a decimal to a protobuf stream
        /// </summary>
        public static void WriteDecimal(decimal value, ProtoWriter writer)
        {
            int[] bits = decimal.GetBits(value);
            ulong a = ((ulong)bits[1]) << 32, b = ((ulong)bits[0]) & 0xFFFFFFFFL;
            ulong low       = a | b;
            uint  high      = (uint)bits[2];
            uint  signScale = (uint)(((bits[3] >> 15) & 0x01FE) | ((bits[3] >> 31) & 0x0001));

            SubItemToken token = ProtoWriter.StartSubItem(null, writer);

            if (low != 0)
            {
                ProtoWriter.WriteFieldHeader(FieldDecimalLow, WireType.Variant, writer);
                ProtoWriter.WriteUInt64(low, writer);
            }
            if (high != 0)
            {
                ProtoWriter.WriteFieldHeader(FieldDecimalHigh, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(high, writer);
            }
            if (signScale != 0)
            {
                ProtoWriter.WriteFieldHeader(FieldDecimalSignScale, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(signScale, writer);
            }
            ProtoWriter.EndSubItem(token, writer);
        }
Пример #2
0
        public static void WriteDecimal(decimal value, ProtoWriter writer)
        {
            int[]        bits  = decimal.GetBits(value);
            long         num   = (long)bits[1] << 32;
            ulong        num2  = (ulong)(bits[0] & uint.MaxValue);
            ulong        num3  = (ulong)(num | (long)num2);
            uint         num4  = (uint)bits[2];
            uint         num5  = (uint)(((bits[3] >> 15) & 0x1FE) | ((bits[3] >> 31) & 1));
            SubItemToken token = ProtoWriter.StartSubItem(null, writer);

            if (num3 != 0L)
            {
                ProtoWriter.WriteFieldHeader(1, WireType.Variant, writer);
                ProtoWriter.WriteUInt64(num3, writer);
            }
            if (num4 != 0)
            {
                ProtoWriter.WriteFieldHeader(2, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(num4, writer);
            }
            if (num5 != 0)
            {
                ProtoWriter.WriteFieldHeader(3, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(num5, writer);
            }
            ProtoWriter.EndSubItem(token, writer);
        }
Пример #3
0
        public static void WriteDecimal(decimal value, ProtoWriter writer)
        {
            int[]        bits  = decimal.GetBits(value);
            ulong        num   = (ulong)((ulong)((long)bits[1]) << 32);
            ulong        num2  = (ulong)((long)bits[0] & (long)((ulong)-1));
            ulong        num3  = num | num2;
            uint         num4  = (uint)bits[2];
            uint         num5  = (uint)((bits[3] >> 15 & 510) | (bits[3] >> 31 & 1));
            SubItemToken token = ProtoWriter.StartSubItem(null, writer);

            if (num3 != 0uL)
            {
                ProtoWriter.WriteFieldHeader(1, WireType.Variant, writer);
                ProtoWriter.WriteUInt64(num3, writer);
            }
            if (num4 != 0u)
            {
                ProtoWriter.WriteFieldHeader(2, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(num4, writer);
            }
            if (num5 != 0u)
            {
                ProtoWriter.WriteFieldHeader(3, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(num5, writer);
            }
            ProtoWriter.EndSubItem(token, writer);
        }
Пример #4
0
        public static void WriteDecimal(decimal value, ProtoWriter writer)
        {
            int[]        bits         = decimal.GetBits(value);
            ulong        num          = (ulong)((long)bits[1] << 32);
            ulong        num1         = (long)bits[0] & (ulong)-1;
            ulong        num2         = num | num1;
            uint         num3         = (uint)bits[2];
            uint         num4         = (uint)(bits[3] >> 15 & 510 | bits[3] >> 31 & 1);
            SubItemToken subItemToken = ProtoWriter.StartSubItem(null, writer);

            if (num2 != (long)0)
            {
                ProtoWriter.WriteFieldHeader(1, WireType.Variant, writer);
                ProtoWriter.WriteUInt64(num2, writer);
            }
            if (num3 != 0)
            {
                ProtoWriter.WriteFieldHeader(2, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(num3, writer);
            }
            if (num4 != 0)
            {
                ProtoWriter.WriteFieldHeader(3, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(num4, writer);
            }
            ProtoWriter.EndSubItem(subItemToken, writer);
        }
Пример #5
0
        /// <summary>
        /// Writes a decimal to a protobuf stream
        /// </summary>
        public static void WriteDecimal(decimal value, ProtoWriter writer)
        {
            var   dec = new DecimalAccessor(value);
            ulong a = ((ulong)dec.Mid) << 32, b = ((ulong)dec.Lo) & 0xFFFFFFFFL;
            ulong low       = a | b;
            uint  high      = (uint)dec.Hi;
            uint  signScale = (uint)(((dec.Flags >> 15) & 0x01FE) | ((dec.Flags >> 31) & 0x0001));

            SubItemToken token = ProtoWriter.StartSubItem(null, writer);

            if (low != 0)
            {
                ProtoWriter.WriteFieldHeader(FieldDecimalLow, WireType.Variant, writer);
                ProtoWriter.WriteUInt64(low, writer);
            }
            if (high != 0)
            {
                ProtoWriter.WriteFieldHeader(FieldDecimalHigh, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(high, writer);
            }
            if (signScale != 0)
            {
                ProtoWriter.WriteFieldHeader(FieldDecimalSignScale, WireType.Variant, writer);
                ProtoWriter.WriteUInt32(signScale, writer);
            }
            ProtoWriter.EndSubItem(token, writer);
        }