Closed yoursunny closed 5 years ago
If you want to save even more space, the uint8_t enable_*
fields, that are used as boolean flags, can be grouped in a single bitfield.
the uint8t enable* fields, that are used as boolean flags, can be grouped in a single bitfield.
Moreover, they can be packed into high bits of FreshnessPeriod. 24 bits are enough for FreshnessPeriod.
As of 513e020a28cc76ac12ee4cdb3bdaf8ebcb13428c,
ndn_metainfo_t
type is declared as:Due to memory alignment rules, the compiler inserts a 3-byte padding before
freshness_period
field. This struct would consume 55 bytes of memory (name_component_t
has 44 bytes).A better arrangement is:
It needs 52 bytes of memory, fewer than the previous layout.