EasyManua.ls Logo

Intel i960 - Natural Alignment

Intel i960
347 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
i960 Processor Compiler User's Guide
7-8
7
Figure 7-1 Natural Alignment
Byte 0
8
4
00 7 0 7
7
0 7
OSD829
b
a
XXXXXXXX
c
d
XXXX
Specifying a user-constrained alignment changes both the tail padding and
the padding between structure members, which can also affect the
structure size. A user-constrained alignment smaller than the natural
alignment of a structure can result in a more tightly packed structure,
saving space but slowing execution.
The example in Figure 7-2 compares the layouts in memory of the
following structure under two different user-constrained alignments:
struct strc1 /* Alignment is 2: Alignment is 1: */
{ /* --------------- --------------- */
char a; /* byte 0 byte 0 */
short b; /* bytes 2 and 3 bytes 1 and 2 */
char c; /* byte 4 byte 5 */
int d; /* bytes 6 through 9 bytes 4 through 7 */
};

Table of Contents

Related product manuals