We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e8b6bc commit 9298cf0Copy full SHA for 9298cf0
src/engine/virtualmachine.cpp
@@ -198,8 +198,12 @@ unsigned int *VirtualMachine::run(unsigned int *pos)
198
DISPATCH();
199
200
do_forever_loop:
201
- while (true)
202
- run(pos);
+ Loop l;
+ l.isRepeatLoop = true;
203
+ l.start = pos;
204
+ l.index = -1;
205
+ m_loops.push_back(l);
206
+ DISPATCH();
207
208
do_repeat_loop:
209
loopCount = READ_LAST_REG()->toLong();
@@ -241,7 +245,7 @@ unsigned int *VirtualMachine::run(unsigned int *pos)
241
245
do_loop_end : {
242
246
Loop &l = m_loops.back();
243
247
if (l.isRepeatLoop) {
244
- if (++l.index < l.max)
248
+ if ((l.index == -1) || (++l.index < l.max))
249
pos = l.start;
250
else
251
m_loops.pop_back();
0 commit comments