Natural Alignment - Intel i960 User Manual

Processor compiler
Hide thumbs Also See for i960:
Table of Contents

Advertisement

7
Figure 7-1
7
7-8
i960 Processor Compiler User's Guide

Natural Alignment

0 7
0 7
b
XXXXXXXX
d
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
/*
{
/*
char
a;
/*
short b;
/*
char
c;
/*
int
d;
/*
};
0 7
XXXX
Alignment is 2:
---------------
byte 0
bytes 2 and 3
byte 4
bytes 6 through 9
0
a
Byte 0
c
4
8
OSD829
Alignment is 1:
---------------
byte 0
bytes 1 and 2
byte 5
bytes 4 through 7 */
*/
*/
*/
*/
*/

Advertisement

Table of Contents
loading

Table of Contents