English
Language : 

CC78K0S Datasheet, PDF (363/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 11 EXTENDED FUNCTIONS
Bit Field Declaration
Bit field declaration
EXPLANATION
Figure 11-2. Bit Allocation by Bit Field Declaration (Example 2)
Bit field allocated from the MSB side
when the -RB option is specified
Bit field allocated from the LSB side
when the -RB option is not 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. Members b and c are allocated to subsequent byte
units, starting from the second byte unit. If a byte unit does not have enough space to hold the type char
member, that member will be allocated to the following byte unit. In this case, if there is only space for 3 bits in
the second byte unit, and member d has four bits, it will be allocated to the third byte unit.
Vacant
d
Vacant
Vacant
Vacant
d
3
2
3
2
e
e
e
e
5
4
5
4
f
g
g
Vacant
Vacant
g
g
f
7
6
7
6
Vacant
h
Vacant
Vacant
Vacant
h
9
8
9
8
Since member g is a bit field of type unsigned int, it can be allocated across byte boundaries. Since h is a bit
field of type unsigned char, it is not allocated in the same byte unit as the g bit field of type unsigned int, but is
allocated in the next byte unit.
i
Vacant
Vacant
Vacant
Vacant
i
11
10
11
10
Since i is a bit field of type unsigned int, it is allocated in the next word unit.
User’s Manual U14872EJ1V0UM
363