Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
Document Table of Contents

6.4. Data Widths and the HAL Type Definitions

For embedded processors such as the Nios II processor, it is often important to know the exact width and precision of data. Because the ANSI C data types do not explicitly define data width, the HAL uses a set of standard type definitions instead. The ANSI C types are supported, but their data widths are dependent on the compiler’s convention.

The header file alt_types.h defines the HAL type definitions.

Table 26.  The HAL Type Definitions
Type Meaning
alt_8 Signed 8-bit integer.
alt_u8 Unsigned 8-bit integer.
alt_16 Signed 16-bit integer.
alt_u16 Unsigned 16-bit integer.
alt_32 Signed 32-bit integer.
alt_u32 Unsigned 32-bit integer.
alt_64 Signed 64-bit integer.
alt_u64 Unsigned 64-bit integer.
Table 27.  GNU Toolchain Data Widths
Type Meaning
char 8 bits.
short 16 bits.
long 32 bits.
int 32 bits.