| 1018 | } |
| 1019 | |
| 1020 | static struct ewah_bitmap *find_bitmap_for_commit(struct bitmap_index *bitmap_git, |
| 1021 | struct commit *commit, |
| 1022 | struct bitmap_index **found) |
| 1023 | { |
| 1024 | khiter_t hash_pos; |
| 1025 | if (!bitmap_git) |
| 1026 | return NULL; |
| 1027 | |
| 1028 | hash_pos = kh_get_oid_map(bitmap_git->bitmaps, commit->object.oid); |
| 1029 | if (hash_pos >= kh_end(bitmap_git->bitmaps)) { |
| 1030 | struct stored_bitmap *bitmap = NULL; |
| 1031 | if (!bitmap_git->table_lookup) |
| 1032 | return find_bitmap_for_commit(bitmap_git->base, commit, |
| 1033 | found); |
| 1034 | |
| 1035 | /* this is a fairly hot codepath - no trace2_region please */ |
| 1036 | /* NEEDSWORK: cache misses aren't recorded */ |
| 1037 | bitmap = lazy_bitmap_for_commit(bitmap_git, commit); |
| 1038 | if (!bitmap) |
| 1039 | return find_bitmap_for_commit(bitmap_git->base, commit, |
| 1040 | found); |
| 1041 | if (found) |
| 1042 | *found = bitmap_git; |
| 1043 | return lookup_stored_bitmap(bitmap); |
| 1044 | } |
| 1045 | if (found) |
| 1046 | *found = bitmap_git; |
| 1047 | return lookup_stored_bitmap(kh_value(bitmap_git->bitmaps, hash_pos)); |
| 1048 | } |
| 1049 | |
| 1050 | struct ewah_bitmap *bitmap_for_commit(struct bitmap_index *bitmap_git, |
| 1051 | struct commit *commit) |