From 2eb1eaf100e4bbfd0350d7bd4214669046d6dd16 Mon Sep 17 00:00:00 2001
From: He Zhu <h.zhu18@student.unimelb.edu.au>
Date: Sun, 2 Sep 2018 18:26:51 +1000
Subject: [PATCH] Update Machine.java
---
mutants/mutant-4/swen90006/machine/Machine.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mutants/mutant-4/swen90006/machine/Machine.java b/mutants/mutant-4/swen90006/machine/Machine.java
index 9bf5731..22abf16 100644
--- a/mutants/mutant-4/swen90006/machine/Machine.java
+++ b/mutants/mutant-4/swen90006/machine/Machine.java
@@ -140,7 +140,7 @@ public class Machine
private void validate_reg(int reg)
throws InvalidInstructionException
{
- if (reg < 0 || reg > MAX_REG) {
+ if (reg < 0 && reg > MAX_REG) {
throw new InvalidInstructionException();
}
}
@@ -170,7 +170,7 @@ public class Machine
int pc = 0;
final int progLength = instructions.size();
while(true){
- if (pc < 0 || pc >= progLength){
+ if (pc < 0 && pc >= progLength){
/* will cause NoReturnValueException to be thrown
* but that is not a bug and and indeed is what the
* VM is supposed to do if the pc becomes negative,
--
GitLab