[repacker] optimize index_for_offset.

This commit is contained in:
Garret Rieger 2022-08-18 01:18:16 +00:00
parent 52303638b9
commit 46b5dbd7ce
1 changed files with 4 additions and 1 deletions

View File

@ -521,8 +521,11 @@ struct graph_t
const auto& node = object (node_idx);
if (offset < node.head || offset >= node.tail) return -1;
for (const auto& link : node.real_links)
unsigned length = node.real_links.length;
for (unsigned i = 0; i < length; i++)
{
// Use direct access for increased performance, this is a hot method.
const auto& link = node.real_links.arrayZ[i];
if (offset != node.head + link.position)
continue;
return link.objidx;