Amqp.Types.Encoder.WriteULong C# (CSharp) Method

WriteULong() public static method

Writes an unsigned 64-bit integer value to a buffer.
public static WriteULong ( System.ByteBuffer buffer, ulong value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value ulong The unsigned 64-bit integer value.
smallEncoding bool if true, try using small encoding if possible.
return void
        public static void WriteULong(ByteBuffer buffer, ulong value, bool smallEncoding)
        {
            if (!smallEncoding || value > byte.MaxValue)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.ULong);
                AmqpBitConverter.WriteULong(buffer, value);
            }
            else if (value == 0)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.ULong0);
            }
            else if (value <= byte.MaxValue)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.SmallULong);
                AmqpBitConverter.WriteUByte(buffer, (byte)value);
            }
        }