コード例 #1
0
        public UInt64 ReadUInt64()
        {
            NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);

            ulong low = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);

            m_readPosition += 32;
            ulong high = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);

            ulong retval = low + (high << 32);

            m_readPosition += 32;
            return(retval);
        }
コード例 #2
0
        public UInt64 PeekUInt64(int numberOfBits)
        {
            NetException.Assert((numberOfBits > 0 && numberOfBits <= 64), "ReadUInt() can only read between 1 and 64 bits");
            NetException.Assert(m_bitLength - m_readPosition >= numberOfBits, c_readOverflowError);

            ulong retval;

            if (numberOfBits <= 32)
            {
                retval = (ulong)NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
            }
            else
            {
                retval  = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
                retval |= NetBitWriter.ReadUInt32(m_data, numberOfBits - 32, m_readPosition) << 32;
            }
            return(retval);
        }