template bool *NumberToBin(TYPE Number) { unsigned int BitSize = 8 * sizeof(TYPE) - 2; bool *Bin = new bool[BitSize]; unsigned char Counter = 0; for (int i=BitSize;i>-1;i--) { Bin[Counter] = IS_BIT_SET(Number, i) ? 1 : 0; ++Counter; } return Bin; } template TYPE BinToNumber(bool *Bin, bool Delete = false) { unsigned char TypeLen = 8 * sizeof(TYPE) - 2; TYPE RetVal = 0; for (char c=TypeLen;c>-1;c--) { if (Bin[c]) BIT_SET(RetVal, TypeLen-c); else BIT_CLEAR(RetVal, TypeLen-c); } if (Delete) delete[] Bin; return RetVal; } #define PACKET_MAX_LEN 65536 char m_Data[PACKET_MAX_LEN]; // 0 - 65535 unsigned int m_Pos; unsigned int m_Length; void BitModi(int i, int j, bool *Bin) { unsigned char Counter = 0; for (;i(Data); BitModi(0, 8, Bin); DumpCur(); ++m_Pos; BitModi(8, 16, Bin); DumpCur(); ++m_Pos; BitModi(16, 24, Bin); DumpCur(); ++m_Pos; BitModi(24, 31, Bin); DumpCur(); ++m_Pos; m_Length = m_Pos; }