Nguyễn Thái Ngọc Duy  <pclo...@gmail.com> writes:

> Notice that packing_data::nr_objects is uint32_t, we could only handle
> maximum 4G objects and can address all of them with an uint32_t. If we
> use a pointer here, we waste 4 bytes on 64 bit architecture.

Some things are left unsaid or left unclear and make readers stutter
a bit while reading this paragraph.  We can address them with
uint32_t only because we happen to have a linear array of all
objects involved already, i.e. the pack->objects[] array.  The
readers are forced to rephrase the above in their mind

        ... and each of them can be identified with an uint32_t.
        Because we have all of these objects in pack->objects[], we
        can replace the "delta" field in each object entry that
        points at its delta base object with uint32_t index into
        this array to save memory (on 64-bit arch, 8-byte pointer
        gets shrunk to 4-byte uint).

or something like that before understanding why this is a valid
memory footprint optimization.

Reply via email to