diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -892,7 +892,7 @@ TARGET_##op: \ opcode = op; \ if (HAS_ARG(op)) \ - oparg = NEXTARG(); \ + {oparg = GETARG(); EATARG();} \ case op: \ goto impl; \ @@ -900,7 +900,7 @@ TARGET_##op: \ opcode = op; \ if (HAS_ARG(op)) \ - oparg = NEXTARG(); \ + {oparg = GETARG(); EATARG();} \ case op: @@ -996,8 +996,14 @@ #define INSTR_OFFSET() ((int)(next_instr - first_instr)) #define NEXTOP() (*next_instr++) -#define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2]) +#define EATARG() (next_instr += 2) +#if PY_LITTLE_ENDIAN +#define GETARG() ((int)(*((unsigned short *)next_instr))) +#define PEEKARG() ((int)(*((unsigned short *)(next_instr + 1)))) +#else +#define GETARG() (next_instr[1]<<8) + next_instr[0]) #define PEEKARG() ((next_instr[2]<<8) + next_instr[1]) +#endif #define JUMPTO(x) (next_instr = first_instr + (x)) #define JUMPBY(x) (next_instr += (x)) @@ -1326,7 +1332,7 @@ oparg = 0; /* allows oparg to be stored in a register because it doesn't have to be remembered across a full loop */ if (HAS_ARG(opcode)) - oparg = NEXTARG(); + {oparg = GETARG(); EATARG();}; dispatch_opcode: #ifdef DYNAMIC_EXECUTION_PROFILE #ifdef DXPAIRS @@ -3433,7 +3439,8 @@ TARGET(EXTENDED_ARG) { opcode = NEXTOP(); - oparg = oparg<<16 | NEXTARG(); + oparg = oparg<<16 | GETARG(); + EATARG(); goto dispatch_opcode; }