I think the version you (probably) proposed is: struct LV2_EVENT_HDR { uint32_t frame, subframe; unsigned int size:24; unsigned int type:8; // put data here, but header size+data size must be a multiple of 8 };
plus 8-byte alignment requirement (ie. header size+payload size must be an integer multiple of 8), is going to work. Either that, or 16 bits for both size and type. Or 16 bits for size and 8 bits for type, and the remaining byte may be used for char field in payload (5 byte payload "for free"). All three are more or less equally good/bad. MIDI would look like this: 12 bytes header, (up to) 3 bytes content, 1 byte padding - which is fine. Same for pointer-only data on 32-bit architecture, for 64-bit, there would be a padding of 4 bytes followed by 8-byte pointer. Not very elegant, but perfectly acceptable. Plus, the compiler takes care of generating padding. Krzysztof _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev