Enables alignment of struct members.
Syntax
Arguments
None
Default
Define
None
Scope
You should only enable this option when optimizing for speed (-opt speed or -opt nospace in the compiler command line).
If enabled when optimizing for size (-opt space or -opt nospeed), the option has no effect.
Description
This option enables alignment of struct members.
he S12Z compiler can optimize either for code size (default) or for execution speed. Since the S12Z CPU data bus operates
on 32-bit address boundaries, one way to improve execution time is to ensure that accesses to struct members are such that,
if the struct itself is aligned to a multiple of 4, the corresponding data transfer need not be split into two consecutive
bus accesses. This can be accomplished by aligning the struct members, i.e. making sure that:
- 64-bit members are aligned to 4 (the address is a multiple of 4);
- no 16-bit member is aligned to “4 + 3” (the address is not a ‘<multiple of 4> + 3’);
- no 24-bit member is aligned to either “4 + 2” or “4 + 3” (the address is not a ‘<multiple of 4> + 2’ or a ‘<multiple of 4> + 3’).
Note: If this option is enabled, the offsets of the struct members might change. If your application relies on the default offset values,
it will no longer work as expected.