MCPcopy Create free account
hub / github.com/git/git / bsearch_pack

Function bsearch_pack

packfile.c:2002–2024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2000}
2001
2002int 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
2026int nth_packed_object_id(struct object_id *oid,
2027 struct packed_git *p,

Callers 4

bitmap_bsearch_posFunction · 0.85
find_pack_entry_oneFunction · 0.85
find_abbrev_len_for_packFunction · 0.85

Calls 1

bsearch_hashFunction · 0.85

Tested by

no test coverage detected