mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
Use stop variable instead of return
This commit is contained in:
parent
c59e29a5c8
commit
21c3b1ebb0
|
@ -73,7 +73,9 @@ void ASM::populate_cache(size_t pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASM::run() {
|
void ASM::run() {
|
||||||
while (pc < program_size) {
|
bool stop = false;
|
||||||
|
|
||||||
|
while (!stop && pc < program_size) {
|
||||||
OpcodeShort opcode = static_cast<OpcodeShort>(read_byte(pc));
|
OpcodeShort opcode = static_cast<OpcodeShort>(read_byte(pc));
|
||||||
if (static_cast<uint8_t>(opcode) & (1 << 7)) {
|
if (static_cast<uint8_t>(opcode) & (1 << 7)) {
|
||||||
// Long opcode
|
// Long opcode
|
||||||
|
@ -91,7 +93,8 @@ void ASM::run() {
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpcodeShort::WaitRefresh:
|
case OpcodeShort::WaitRefresh:
|
||||||
return;
|
stop = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case OpcodeShort::Push0:
|
case OpcodeShort::Push0:
|
||||||
push(std::make_shared<ValueInteger>(0));
|
push(std::make_shared<ValueInteger>(0));
|
||||||
|
@ -154,7 +157,7 @@ void ASM::run() {
|
||||||
|
|
||||||
case OpcodeShort::Branch: {
|
case OpcodeShort::Branch: {
|
||||||
if (doBranch(pop_uint32()))
|
if (doBranch(pop_uint32()))
|
||||||
return;
|
stop = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +166,7 @@ void ASM::run() {
|
||||||
auto cond = pop();
|
auto cond = pop();
|
||||||
|
|
||||||
if (cond->isTruthy() && doBranch(to))
|
if (cond->isTruthy() && doBranch(to))
|
||||||
return;
|
stop = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue