Skip to main content

IAR Embedded Workbench for RH850 3.20.x

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.

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. The default behavior for the compiler is joined_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

Bitfields.