English
Language : 

CC78K4 Datasheet, PDF (369/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 11 EXTENDED FUNCTIONS
Bit Field Declaration
Bit field declaration
EXPLANATION
Because a through h are 8 bits or less, they are allocated in 1-byte units.
If the bit field is allocated to saddr2 or saddr1 area by the keywords sreg/_ _sreg/_ _sreg1, a bit manipulation
instruction is output, and codes can be reduced.
Figure 11-1. Bit Allocation by Bit Field Declaration (Example 1)
Bit allocation from MSB
with -RB option specified
Bit allocation from LSB
without -RB option specified
MSB
LSB
abcde f gh
MSB
LSB
hg f edcba
EXAMPLE 2
(Bit field declaration)
struct t {
char
a;
unsigned char b:2;
unsigned char c:3;
unsigned char d:4;
Int
e;
unsigned int f:5;
unsigned int g:6;
unsigned char h:2;
unsigned int i:2;
};
EXPLANATION
If the bit field is allocated to saddr2 or saddr1 area by the keywords sreg/_ _sreg/_ _sreg1, the code efficiency
can be improved.
User’s Manual U15556EJ1V0UM
369