Files
PX4-Autopilot/Tools/msg/templates
Jacob DahlandBalduin 791ba46833 refactor(msg): address CDR fields by offset in the generated serializers (#29546)
The generated ucdr_serialize/ucdr_deserialize functions advanced
buf.iterator and buf.offset after every field. Because the memcpy
through buf.iterator may alias the ucdrBuffer itself, the compiler had
to reload the iterator, store it back and update the offset in memory
for each field: four extra instructions per field, in every topic
forwarded by uxrce_dds_client.

Compute the CDR offset of each field in the generator instead, copy
relative to the position at entry, and advance the buffer once by the
topic size. The wire format and the final buffer state are unchanged; a
host test serializing and deserializing random data for all 259 topics
with the old and new headers gives identical bytes, structs and buffer
positions.

px4_fmu-v6x_default: 1929304 -> 1919176 bytes of text, -10128 B.

Assisted-by: Claude:claude-fable-5-1

Co-authored-by: Balduin <balduin@auterion.com>
2026-10-31 12:12:55 -06:00
..
…