| 496 | #define MIDX_CHUNK_BITMAPPED_PACKS_WIDTH (2 * sizeof(uint32_t)) |
| 497 | |
| 498 | int 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 | |
| 521 | int bsearch_one_midx(const struct object_id *oid, struct multi_pack_index *m, |
| 522 | uint32_t *result) |