mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 22:50:49 +08:00
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>