summaryrefslogtreecommitdiff
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-04-14 17:35:06 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-04-16 12:38:58 +0900
commit898eba5e630696608ddca0ede489378e87464ad6 (patch)
tree6c932809a3def3b470165853c006ee2f57d78e03 /fetch-pack.c
parentpack-objects: move in_pack out of struct object_entry (diff)
downloadtgif-898eba5e630696608ddca0ede489378e87464ad6.tar.xz
pack-objects: refer to delta objects by index instead of pointer
These delta pointers always point to elements in the objects[] array in packing_data struct. We can only hold maximum 4G of those objects because the array size in nr_objects is uint32_t. We could use uint32_t indexes to address these elements instead of pointers. On 64-bit architecture (8 bytes per pointer) this would save 4 bytes per pointer. Convert these delta pointers to indexes. Since we need to handle NULL pointers as well, the index is shifted by one [1]. [1] This means we can only index 2^32-2 objects even though nr_objects could contain 2^32-1 objects. It should not be a problem in practice because when we grow objects[], nr_alloc would probably blow up long before nr_objects hits the wall. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fetch-pack.c')
0 files changed, 0 insertions, 0 deletions