Beispiel #1
0
        public ulong ReadUInt64(int numBits)
        {
            ulong result = FastStruct <ulong> .ArrayToStructure(ref m_array[m_readOffset + (m_readPos >> 3)]) << (64 - numBits - (m_readPos & 7)) >> (64 - numBits);

            m_readPos += numBits;
            return(result);
        }
Beispiel #2
0
        public uint ReadUInt32(int numBits)
        {
            uint result = FastStruct <uint> .ArrayToStructure(ref m_array[m_readOffset + (m_readPos >> 3)]) << (32 - numBits - (m_readPos & 7)) >> (32 - numBits);

            m_readPos += numBits;
            return(result);
        }
 public T GetValue <T>() where T : struct
 {
     unsafe
     {
         fixed(byte *ptr = Value)
         return(FastStruct <T> .ArrayToStructure(ref ptr[0]));
     }
 }
Beispiel #4
0
    public T Read <T>(MemoryStream ms) where T : struct
    {
        int size = FastStruct <T> .Size;

        byte[] result = new byte[size];
        ms.Read(result, 0, size);
        return(FastStruct <T> .ArrayToStructure(result));
    }
Beispiel #5
0
    public static T Read <T>(this BinaryReader reader) where T : struct
    {
        byte[] result = reader.ReadBytes(FastStruct <T> .Size);

        return(FastStruct <T> .ArrayToStructure(result));
    }
Beispiel #6
0
 public void Parse(byte[] bytes)
 {
     Header = FastStruct <Structure> .ArrayToStructure(bytes);
 }