| 227 | #define BITMAP_POS_CACHE_VALID (1U << 31) |
| 228 | |
| 229 | static void bitmap_writer_init_pos_cache(struct bitmap_writer *writer) |
| 230 | { |
| 231 | if (writer->pos_cache) |
| 232 | return; |
| 233 | |
| 234 | writer->pos_cache_nr = BITMAP_POS_MIN_CACHE_SIZE; |
| 235 | |
| 236 | while (writer->pos_cache_nr < writer->to_pack->nr_objects && |
| 237 | writer->pos_cache_nr < BITMAP_POS_MAX_CACHE_SIZE) |
| 238 | writer->pos_cache_nr <<= 1; |
| 239 | |
| 240 | CALLOC_ARRAY(writer->pos_cache, writer->pos_cache_nr); |
| 241 | } |
| 242 | |
| 243 | static size_t bitmap_writer_pos_cache_slot(struct bitmap_writer *writer, |
| 244 | const struct object_id *oid) |