for really specific alignments of the structure, you can play with fill bytes
So, add a few dummy bytes between the various fields until the alignment suits your needs.
Example:
Example
struct {unsigned short x; byte dummy1; dummy2 byte dummy3 byte byte dummy4; dummy5 byte byte dummy6; unsigned int y; };
if the dummy bytes have not been placed, int, probably would have been a displacement of 4 (4 bytes from the beginning of the structure, and now he was placed with an offset 8)
waring: very specific compiler and bad code, ^)
source share