EasyManua.ls Logo

Intel i960 - Page 199

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-10
7
If struct NATURAL has natural alignment, one byte of padding appears
between the members
c1 and s. Under optimal natural alignment, the size
is 8 and the alignment is 8. Under backward compatible natural
alignment, the size is 6 and the alignment is 2. If
struct
CONSTRAINED_1
has a user-constrained alignment of one, no padding
appears between members
c and n, nor does any padding follow the
member
n. However, all of the padding mentioned previously as part of
struct NATURAL still appears in member n of struct CONSTRAINED_1.
Bit Field Alignment
Every bit field lies entirely within some bit-field container that has the
same size and alignment as an int; that is, the container alignment is the
smaller of 4 or a user specified alignment. A bit field can cross byte
boundaries but cannot cross a container boundary.
Alignment of an individual bit field is necessary when the bit field,
unaligned, overruns the end of the container in which it starts. A bit-field
size of zero also forces bit-field alignment. The alignment of a bit field
and the position of the bit field within a structure are determined as
follows:
The byte position of a bit field within a container is the current byte
offset in the structure modulo the container alignment. This value is
the byte offset relative to the most recent container alignment
boundary. For example, if the container alignment is 1, the byte
position is always zero. If the container alignment is 4, the byte
position can be 0, 1, 2, or 3.
The bit position of the bit field is the number of bits already allocated
in the current byte, plus eight times the container byte position. This
value is the bit offset, in the range 0 to 31, relative to the most recent
container alignment boundary.

Table of Contents

Related product manuals