Skip to main content

IAR Embedded Workbench for RL78 5.20

bitfields

In this section:
Syntax
#pragma bitfields={disjoint_types|joined_types|
                   reversed_disjoint_types|reversed|default}
Parameters

disjoint_types

Bitfield members are placed from the least significant bit to the most significant bit in the container type. Storage containers of bitfields with different base types will not overlap.

joined_types

Bitfield members are placed depending on the byte order. Storage containers of bitfields will overlap other structure members. For more information, see Bitfields. This parameter is not available if you use the V1 calling convention as the default calling convention.

reversed_disjoint_types

Bitfield members are placed from the most significant bit to the least significant bit in the container type. Storage containers of bitfields with different base types will not overlap.

reversed

This is an alias for reversed_disjoint_types.

default

Restores the default layout of bitfield members. If you use the V2 calling convention as the default calling convention, the default behavior for the compiler is joined_types. If you use the V1 calling convention as the default calling convention, the default behavior for the compiler is disjoint_types.

Description

Use this pragma directive to control the layout of bitfield members.

Example
#pragma bitfields=disjoint_types
/* Structure that uses disjoint bitfield types. */
struct S
{
  unsigned char  error : 1;
  unsigned char  size  : 4;
  unsigned short code  : 10;
};
#pragma bitfields=default /* Restores to default setting. */
See also

Calling convention and Bitfields.