English
Language : 

CC78K4 Datasheet, PDF (370/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 11 EXTENDED FUNCTIONS
Bit Field Declaration
Bit field declaration
Figure 11-2. Bit Allocation by Bit Field Declaration (Example 2) (1/2)
Bit allocation from MSB
with -RB option specified
Bit allocation from LSB
without -RB option specified
MSB
b
c Vacant
LSB
a
MSB
Vacant c
b
LSB
a
1
0
1
0
Member a of char type is allocated to the first byte unit. b and c are allocated from the next byte unit. If the
vacancy has run short, the members are allocated to the next byte unit. Because the vacancy is 3 bits and d is 4
bits in this example, d is allocated to the next byte unit.
e
d
Vacant
e
Vacant
d
3
2
3
2
g
Vacant
e
g
f
e
5
4
5
4
The 78K/IV Series has 1-byte alignment; therefore, e (2 bytes) can straddle over a byte boundary.
h
Vacant
f
g
Vacant
h
Vacant
g
7
6
7
6
Because g is an unsigned int type bit field, it can be allocated across byte boundary. h is an unsigned char
type bit field; it is therefore allocated to the next byte unit, instead to the same byte unit as g, which is an
unsigned int type bit field.
h
Vacant
Vacant
Vacant
Vacant
i
9
8
9
8
i is an unsigned int type bit field and can be allocated to the next word unit.
Remark The numbers below the allocation diagrams indicate the byte offset values from the beginning of the
structure.
370
User’s Manual U15556EJ1V0UM