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

Function nth_midxed_offset

midx.c:561–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559}
560
561off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos)
562{
563 const unsigned char *offset_data;
564 uint32_t offset32;
565
566 pos = midx_for_object(&m, pos);
567
568 offset_data = m->chunk_object_offsets + (off_t)pos * MIDX_CHUNK_OFFSET_WIDTH;
569 offset32 = get_be32(offset_data + sizeof(uint32_t));
570
571 if (m->chunk_large_offsets && offset32 & MIDX_LARGE_OFFSET_NEEDED) {
572 if (sizeof(off_t) < sizeof(uint64_t))
573 die(_("multi-pack-index stores a 64-bit offset, but off_t is too small"));
574
575 offset32 ^= MIDX_LARGE_OFFSET_NEEDED;
576 if (offset32 >= m->chunk_large_offsets_len / sizeof(uint64_t))
577 die(_("multi-pack-index large offset out of bounds"));
578 return get_be64(m->chunk_large_offsets + sizeof(uint64_t) * offset32);
579 }
580
581 return offset32;
582}
583
584uint32_t nth_midxed_pack_int_id(struct multi_pack_index *m, uint32_t pos)
585{

Callers 9

show_objects_for_typeFunction · 0.85
get_size_by_posFunction · 0.85
get_disk_usage_for_typeFunction · 0.85
fill_midx_entryFunction · 0.85
midx_pack_order_cmpFunction · 0.85
midx_to_pack_posFunction · 0.85
write_reused_packFunction · 0.85

Calls 4

midx_for_objectFunction · 0.85
get_be32Function · 0.85
get_be64Function · 0.85
dieFunction · 0.70

Tested by

no test coverage detected