void bc_next(PycBuffer& source, PycModule* mod, int& opcode, int& operand, int& pos) { opcode = Pyc::ByteToOpcode(mod->majorVer(), mod->minorVer(), source.getByte()); operand = 0; bool haveExtArg = false; pos += 1; if (opcode == Pyc::EXTENDED_ARG_A) { operand = source.get16() << 16; opcode = source.getByte(); haveExtArg = true; pos += 3; } if (opcode >= Pyc::PYC_HAVE_ARG) { // If we have an extended arg, we want to OR the lower part, // else we want the whole thing (in case it's negative). We use // the bool so that values between 0x8000 and 0xFFFF can be stored // without becoming negative if (haveExtArg) operand |= (source.get16() & 0xFFFF); else operand = source.get16(); pos += 2; } }
void bc_next(PycBuffer& source, PycModule* mod, int& opcode, int& operand, int& pos) { opcode = Pyc::ByteToOpcode(mod->majorVer(), mod->minorVer(), source.getByte()); operand = 0; pos += 1; if (opcode == Pyc::EXTENDED_ARG_A) { operand = source.get16() << 16; opcode = Pyc::ByteToOpcode(mod->majorVer(), mod->minorVer(), source.getByte()); pos += 3; } if (opcode >= Pyc::PYC_HAVE_ARG) { operand |= source.get16(); pos += 2; } }