| 241 | } |
| 242 | |
| 243 | const DexFile::FieldId* DexFile::FindFieldId(const DexFile::TypeId& declaring_klass, |
| 244 | const DexFile::StringId& name, |
| 245 | const DexFile::TypeId& type) const { |
| 246 | // Binary search MethodIds knowing that they are sorted by class_idx, name_idx then proto_idx |
| 247 | const dex::TypeIndex class_idx = GetIndexForTypeId(declaring_klass); |
| 248 | const dex::StringIndex name_idx = GetIndexForStringId(name); |
| 249 | const dex::TypeIndex type_idx = GetIndexForTypeId(type); |
| 250 | int32_t lo = 0; |
| 251 | int32_t hi = NumFieldIds() - 1; |
| 252 | while (hi >= lo) { |
| 253 | int32_t mid = (hi + lo) / 2; |
| 254 | const DexFile::FieldId& field = GetFieldId(mid); |
| 255 | if (class_idx > field.class_idx_) { |
| 256 | lo = mid + 1; |
| 257 | } else if (class_idx < field.class_idx_) { |
| 258 | hi = mid - 1; |
| 259 | } else { |
| 260 | if (name_idx > field.name_idx_) { |
| 261 | lo = mid + 1; |
| 262 | } else if (name_idx < field.name_idx_) { |
| 263 | hi = mid - 1; |
| 264 | } else { |
| 265 | if (type_idx > field.type_idx_) { |
| 266 | lo = mid + 1; |
| 267 | } else if (type_idx < field.type_idx_) { |
| 268 | hi = mid - 1; |
| 269 | } else { |
| 270 | return &field; |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | return nullptr; |
| 276 | } |
| 277 | |
| 278 | const DexFile::MethodId* DexFile::FindMethodId(const DexFile::TypeId& declaring_klass, |
| 279 | const DexFile::StringId& name, |
nothing calls this directly
no outgoing calls
no test coverage detected