#define INSTR_OFFSET() (next_instr - first_instr)
#define NEXTOP() (*next_instr++)
-#define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2])
+#define OPARG() (next_instr[0] + (next_instr[1]<<8))
+#define SKIPARG() (next_instr += 2)
#define JUMPTO(x) (next_instr = first_instr + (x))
#define JUMPBY(x) (next_instr += (x))
/* Extract opcode and argument */
opcode = NEXTOP();
- if (HAS_ARG(opcode))
- oparg = NEXTARG();
+ if (HAS_ARG(opcode)) {
+ oparg = OPARG();
+ SKIPARG();
+ }
dispatch_opcode:
#ifdef DYNAMIC_EXECUTION_PROFILE
#ifdef DXPAIRS
if (why & (WHY_RETURN | WHY_CONTINUE))
retval = POP();
}
- else if (PyString_Check(v) || PyClass_Check(v)) {
+ else if (PyClass_Check(v) || PyString_Check(v)) {
w = POP();
u = POP();
PyErr_Restore(v, w, u);
case BUILD_TUPLE:
x = PyTuple_New(oparg);
if (x != NULL) {
- for (; --oparg >= 0;) {
+ while (oparg--) {
w = POP();
PyTuple_SET_ITEM(x, oparg, w);
}
case BUILD_LIST:
x = PyList_New(oparg);
if (x != NULL) {
- for (; --oparg >= 0;) {
+ while (oparg--) {
w = POP();
PyList_SET_ITEM(x, oparg, w);
}
x = NULL;
break;
}
- while (--oparg >= 0) {
+ while (oparg--) {
w = POP();
PyTuple_SET_ITEM(v, oparg, w);
}
x = NULL;
break;
}
- while (--nfree >= 0) {
+ while (nfree--) {
w = POP();
PyTuple_SET_ITEM(v, nfree, w);
}
x = NULL;
break;
}
- while (--oparg >= 0) {
+ while (oparg--) {
w = POP();
PyTuple_SET_ITEM(v, oparg, w);
}
case EXTENDED_ARG:
opcode = NEXTOP();
- oparg = oparg<<16 | NEXTARG();
+ oparg = oparg<<16 | OPARG();
+ SKIPARG();
goto dispatch_opcode;
default:
}
if (size > 0) {
- while (--size >= 0) {
+ while (size--) {
addr += *p++;
if (*p++)
break;
}
if (kwdict == NULL)
return NULL;
- while (--nk >= 0) {
+ while (nk--) {
int err;
PyObject *value = EXT_POP(*pp_stack);
PyObject *key = EXT_POP(*pp_stack);
PyTuple_SET_ITEM(callargs, nstack + i, a);
}
}
- while (--nstack >= 0) {
+ while (nstack--) {
w = EXT_POP(*pp_stack);
PyTuple_SET_ITEM(callargs, nstack, w);
}
if (args == NULL)
return NULL;
- while (--na >= 0) {
+ while (na--) {
w = EXT_POP(*pp_stack);
PyTuple_SET_ITEM(args, na, w);
}