// Useful reference on opcode operand types: https://stackoverflow.com/questions/7212255 public static bool InstructionsAreEqual(CodeInstruction i1, CodeInstruction i2) { if (i1.operand == null || i2.operand == null) { return(i1.opcode == i2.opcode && i1.operand == i2.operand); } return(i1.Is(i2.opcode, i2.operand)); //recommended comparison method (https://bit.ly/2R7GkeA), but can't handle null }