public int WriteOperand(byte[] array, int index) { int before = index; short val = _op.Value; fixed(byte *a = array) { int size = ILHelper.GetOperandSize(_op.OperandType); for (int i = 0; i < size; i++) { a[index++] = _operand[i]; } } return(index - before); }
public static unsafe Op[] ReadIL(byte *il_ptr, long count) { List <Op> operations = new List <Op>(); void * end = il_ptr + count; while (il_ptr < end) { OpCode code = ILHelper.ReadOpCode(il_ptr); il_ptr += code.Size; byte[] operand = ReadOperand(il_ptr, code.OperandType); il_ptr += operand.Length; operations.Add(new Op(code, operand)); } return(operations.ToArray()); }
public T ReadOperand <T>() where T : unmanaged { fixed(byte *ptr = _operand) return(ILHelper.ReadILValue <T>(ptr)); }