Technical information

Operating Precautions for CPDW9X/NT-CDR-V85X, Y-GHS-MULTI-V800
TM
Customer Notification r20tu0003ed1812 47
No. a33
The use of the bit instruction NOT1 is not systematic in XOR operation
Version Information
V3.5
Details
when compiling C code using the ^ (xor) bit operation with size optimization,
the assembly instruction NOT1 is not used in all cases, although its use will
reduce the code size.
Example:
test.c
struct bitf {
unsigned char bit00:1;
unsigned char bit01:1;
unsigned char bit02:1;
unsigned char bit03:1;
unsigned char bit04:1;
unsigned char bit05:1;
unsigned char bit06:1;
unsigned char bit07:1;
unsigned char bit08:1;
unsigned char bit09:1;
unsigned char bit10:1;
unsigned char bit11:1;
unsigned char bit12:1;
unsigned char bit13:1;
unsigned char bit14:1;
unsigned char bit15:1;
};
// bit 3 of port 5
#define P53 ((volatile struct bitf *)0xfffff40a)->bit03
// Port 5 register
#define P5 *((volatile unsigned char *)0xfffff40a)
void main(void)
{
P5 ^= 0x08;
P53 ^= 1;
}
Command Sequence
ccv850e -OS -S test.c