XS1 Data Types

The size and alignment of C and XC’s data types are not specified by the language. This allows the size of int to be set to the natural word size of the target device, ensuring the fastest possible performance for many computations. It also allows the alignment to be set wide enough to enable efficient memory loads and stores. Size and alignment of data types on XS1 devices represents the size and alignment of the data types specified by the xCORE Application Binary Interface, which provides a standard interface for linking objects compiled from both C and XC.

Size and alignment of data types on XS1 devices

Data Type

Size (bits)

Align (bits)

Supported

Meaning

XC

C

char

8

8

Y

Y

Character type

short

16

16

Y

Y

Short integer

int

32

32

Y

Y

Native integer

long

32

32

Y

Y

Long integer

long long

64

32

N

Y

Long long integer

float

32

32

N

Y

32-bit IEEE float

double

64

32

N

Y

64-bit IEEE float

long double

64

32

N

Y

64-bit IEEE float

void *

32

32

N

Y

Data pointer

port

32

32

Y

N

Port

timer

32

32

Y

N

Timer

chanend

32

32

Y

N

Channel end

In addition:

  • The char type is by default unsigned.

  • The types char, short and int may be specified in a bit-field’s declaration.

  • A zero-width bit-field forces padding until the next bit-offset aligned with the bit-field’s declared type.

  • The notional transfer type of a port is unsigned int (32 bits).

  • The notional counter type of a port is unsigned short (16 bits).

  • The notional counter type of a timer is unsigned int (32 bits).