xcore 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 xcore 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.
Data Type |
Size (bits) |
Align (bits) |
Supported |
Meaning |
|
XC |
C |
||||
|
8 |
8 |
Y |
Y |
Character type |
|
16 |
16 |
Y |
Y |
Short integer |
|
32 |
32 |
Y |
Y |
Native integer |
|
32 |
32 |
Y |
Y |
Long integer |
|
64 |
32 |
N |
Y |
Long long integer |
|
32 |
32 |
N |
Y |
32-bit IEEE float |
|
64 |
32 |
N |
Y |
64-bit IEEE float |
|
64 |
32 |
N |
Y |
64-bit IEEE float |
|
32 |
32 |
N |
Y |
Data pointer |
|
32 |
32 |
Y |
N |
Port |
|
32 |
32 |
Y |
N |
Timer |
|
32 |
32 |
Y |
N |
Channel end |
In addition:
The
char
type is by default unsigned.The types
char
,short
andint
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).