| 2000 | } |
| 2001 | |
| 2002 | int bsearch_pack(const struct object_id *oid, const struct packed_git *p, uint32_t *result) |
| 2003 | { |
| 2004 | const unsigned char *index_fanout = p->index_data; |
| 2005 | const unsigned char *index_lookup; |
| 2006 | const unsigned int hashsz = p->repo->hash_algo->rawsz; |
| 2007 | int index_lookup_width; |
| 2008 | |
| 2009 | if (!index_fanout) |
| 2010 | BUG("bsearch_pack called without a valid pack-index"); |
| 2011 | |
| 2012 | index_lookup = index_fanout + 4 * 256; |
| 2013 | if (p->index_version == 1) { |
| 2014 | index_lookup_width = hashsz + 4; |
| 2015 | index_lookup += 4; |
| 2016 | } else { |
| 2017 | index_lookup_width = hashsz; |
| 2018 | index_fanout += 8; |
| 2019 | index_lookup += 8; |
| 2020 | } |
| 2021 | |
| 2022 | return bsearch_hash(oid->hash, (const uint32_t*)index_fanout, |
| 2023 | index_lookup, index_lookup_width, result); |
| 2024 | } |
| 2025 | |
| 2026 | int nth_packed_object_id(struct object_id *oid, |
| 2027 | struct packed_git *p, |
no test coverage detected