示例#1
0
 public void ReadLeUShort()
 {
     LoadedImage img = new LoadedImage(Address.Ptr32(0x10000), new byte[] {
         0x78, 0x56, 0x34, 0x12 });
     Constant c = img.ReadLe(2, PrimitiveType.Word16);
     Assert.AreSame(PrimitiveType.Word16, c.DataType);
     Assert.AreEqual("0x1234", c.ToString());
 }
示例#2
0
 public void ReadLeNegativeInt()
 {
     LoadedImage img = new LoadedImage(Address.Ptr32(0x10000), new byte[] {
         0xFE, 0xFF, 0xFF, 0xFF });
     Constant c = img.ReadLe(0, PrimitiveType.Int32);
     Assert.AreSame(PrimitiveType.Int32, c.DataType);
     Assert.AreEqual("-2", c.ToString());
 }
示例#3
0
        /// <summary>
        /// Reads a chunk of bytes and interprets it in Little-Endian mode.
        /// </summary>
        /// <param name="type">Enough bytes read </param>
        /// <returns>The read value as a <see cref="Constant"/>.</returns>
        public Constant ReadLe(PrimitiveType type)
        {
            Constant c;

            if (image != null)
            {
                c = image.ReadLe(off, type);
            }
            else
            {
                c = LoadedImage.ReadLe(bytes, Offset, type);
            }
            off += (uint)type.Size;
            return(c);
        }