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

Function nth_bitmapped_pack

midx.c:498–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496#define MIDX_CHUNK_BITMAPPED_PACKS_WIDTH (2 * sizeof(uint32_t))
497
498int nth_bitmapped_pack(struct multi_pack_index *m,
499 struct bitmapped_pack *bp, uint32_t pack_int_id)
500{
501 uint32_t local_pack_int_id = midx_for_pack(&m, pack_int_id);
502
503 if (!m->chunk_bitmapped_packs)
504 return error(_("MIDX does not contain the BTMP chunk"));
505
506 if (prepare_midx_pack(m, pack_int_id))
507 return error(_("could not load bitmapped pack %"PRIu32), pack_int_id);
508
509 bp->p = m->packs[local_pack_int_id];
510 bp->bitmap_pos = get_be32((char *)m->chunk_bitmapped_packs +
511 MIDX_CHUNK_BITMAPPED_PACKS_WIDTH * local_pack_int_id);
512 bp->bitmap_nr = get_be32((char *)m->chunk_bitmapped_packs +
513 MIDX_CHUNK_BITMAPPED_PACKS_WIDTH * local_pack_int_id +
514 sizeof(uint32_t));
515 bp->pack_int_id = pack_int_id;
516 bp->from_midx = m;
517
518 return 0;
519}
520
521int bsearch_one_midx(const struct object_id *oid, struct multi_pack_index *m,
522 uint32_t *result)

Callers 2

Calls 4

midx_for_packFunction · 0.85
errorFunction · 0.85
prepare_midx_packFunction · 0.85
get_be32Function · 0.85

Tested by 1