11.1.8 Controlling the Output of Bit Manipulation Instructions [V1.04 or later]

To output bit manipulation instructions without using embedded functions, satisfy all conditions shown below.

(a)

A constant value is assigned.

(b)

The value is assigned to a single-bit bit field of the charunsigned charsigned char_Bool type in the near area.

(c)

The bit field where the value is assigned is qualified with volatile.

 

For a variable qualified with volatile, the compiler does not output a bit manipulation instruction when a value is assigned to the variable or when the variable is read unless the other conditions are satisfied. For a variable that is not qualified with volatile, the compiler outputs a bit manipulation instruction according to the specified optimization settings.

Example

volatile struct {
  unsigned char bit0:1;
  unsigned int  bit1:1;
} data;
 
void func(void) {
  data.bit0 = 1;  /* A bit manipulation instruction is output. */
  data.bit1 = 1;  /* No bit manipulation instruction is output. */
}