private void WriteBits16(CtpObjectSymbols symbol, uint value) { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)(value >> 8); m_buffer[m_length + 2] = (byte)value; m_length += 3; }
private void WriteBits32(CtpObjectSymbols symbol, uint value) { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)(value >> 24); m_buffer[m_length + 2] = (byte)(value >> 16); m_buffer[m_length + 3] = (byte)(value >> 8); m_buffer[m_length + 4] = (byte)value; m_length += 5; }
private void WriteBits40(CtpObjectSymbols symbol, ulong value) { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)(value >> 32); m_buffer[m_length + 2] = (byte)(value >> 24); m_buffer[m_length + 3] = (byte)(value >> 16); m_buffer[m_length + 4] = (byte)(value >> 8); m_buffer[m_length + 5] = (byte)value; m_length += 6; }
private void WriteBits64(CtpObjectSymbols symbol, ulong value) { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)(value >> 56); m_buffer[m_length + 2] = (byte)(value >> 48); m_buffer[m_length + 3] = (byte)(value >> 40); m_buffer[m_length + 4] = (byte)(value >> 32); m_buffer[m_length + 5] = (byte)(value >> 24); m_buffer[m_length + 6] = (byte)(value >> 16); m_buffer[m_length + 7] = (byte)(value >> 8); m_buffer[m_length + 8] = (byte)value; m_length += 9; }
private void WriteArrayLength(CtpObjectSymbols baseSymbol, int length) { if (length > Bits24) { WriteBits32(baseSymbol + 3, (uint)length); } else if (length > Bits16) { WriteBits24(baseSymbol + 2, (uint)length); } else if (length > Bits8) { WriteBits16(baseSymbol + 1, (uint)length); } else { WriteBits8(baseSymbol + 0, (uint)length); } }
private void WriteNumericHelper(CtpObjectSymbols symbol, byte flags, uint value) { if (value > Bits24) { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)(flags + 192u); m_buffer[m_length + 2] = (byte)(value >> 24); m_buffer[m_length + 3] = (byte)(value >> 16); m_buffer[m_length + 4] = (byte)(value >> 8); m_buffer[m_length + 5] = (byte)value; m_length += 6; } else if (value > Bits16) { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)(flags + 128u); m_buffer[m_length + 2] = (byte)(value >> 16); m_buffer[m_length + 3] = (byte)(value >> 8); m_buffer[m_length + 4] = (byte)value; m_length += 5; } else if (value > Bits8) { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)(flags + 64u); m_buffer[m_length + 2] = (byte)(value >> 8); m_buffer[m_length + 3] = (byte)value; m_length += 4; } else { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)flags; m_buffer[m_length + 2] = (byte)value; m_length += 3; } }
private void WriteBits8(CtpObjectSymbols symbol, uint value) { m_buffer[m_length + 0] = (byte)symbol; m_buffer[m_length + 1] = (byte)value; m_length += 2; }
private void WriteSymbol(CtpObjectSymbols symbol) { m_buffer[m_length + 0] = (byte)symbol; m_length += 1; }