public static ReadLe ( byte abImage, long imageOffset, PrimitiveType type ) : Constant | ||
abImage | byte | |
imageOffset | long | |
type | PrimitiveType | |
return | Constant |
public void ReadLeUInt32() { MemoryArea img = new MemoryArea(Address.Ptr32(0x10000), new byte[] { 0x78, 0x56, 0x34, 0x12 }); Constant c = img.ReadLe(0, PrimitiveType.Word32); Assert.AreSame(PrimitiveType.Word32, c.DataType); Assert.AreEqual("0x12345678", c.ToString()); }
/// <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 = MemoryArea.ReadLe(bytes, Offset, type); } off += (uint)type.Size; return(c); }
public void ReadLeNegativeInt() { MemoryArea img = new MemoryArea(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()); }