MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / SizeInCodeUnitsComplexOpcode

Method SizeInCodeUnitsComplexOpcode

Bcore/src/main/cpp/dex/dex_instruction.cc:98–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98size_t Instruction::SizeInCodeUnitsComplexOpcode() const {
99 const uint16_t* insns = reinterpret_cast<const uint16_t*>(this);
100 // Handle special NOP encoded variable length sequences.
101 switch (*insns) {
102 case kPackedSwitchSignature:
103 return (4 + insns[1] * 2);
104 case kSparseSwitchSignature:
105 return (2 + insns[1] * 4);
106 case kArrayDataSignature: {
107 uint16_t element_size = insns[1];
108 uint32_t length = insns[2] | (((uint32_t)insns[3]) << 16);
109 // The plus 1 is to round up for odd size and width.
110 return (4 + (element_size * length + 1) / 2);
111 }
112 default:
113 if ((*insns & 0xFF) == 0) {
114 return 1; // NOP.
115 } else {
116 LOG(FATAL) << "Unreachable: " << DumpString(nullptr);
117 UNREACHABLE();
118 }
119 }
120}
121
122size_t Instruction::CodeUnitsRequiredForSizeOfComplexOpcode() const {
123 const uint16_t* insns = reinterpret_cast<const uint16_t*>(this);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected