Data Representation

See Itanium ™ Software Conventions & Runtime Architecture Guide Chapter 4.

Within this specification, the term byte refers to an 8-bit object, the term halfword refers to a 16-bit object, the term word refers to a 32-bit object, the term doubleword refers to a 64-bit object, and the term quadword refers to a 128-bit object. Although the Itanium™ architecture also supports 120-bit addressable objects, this specification does not require LSB-conforming implementations to provide support for these objects.

Byte Ordering

LSB-conforming applications shall use little-endian byte ordering. LSB-conforming implementations may support big-endian applications.

Fundamental Types

Table 2-1 describes how fundemental C language data types shall be represented:

Table 2-1. Scalar Types

TypeCsizeofAlignment (bytes)Notes
Integralchar11 
signed char
unsigned char
short22 
signed short
unsigned short
int44 
signed int
unsigned int
long88 
signed long
unsigned long
long long88See Note Below
signed long long
unsigned long long
Pointerany-type *88 
any-type (*)()
Floating-Pointfloat44 
double88 
long double1616 

Note

Support for the long long data type is dependent on support for ISO9899:1999 C language. This standard is not required for LSB-conformance, but this data type is important when developing applications for the Itanium™ architecture. The GNU Compiler Collection (gcc) includes support for long long of ISO9899:1999.

A null pointer (for all types) shall have the value zero.

Aggregates and Unions

Aggregates (structures and arrays) and unions assume the alignment of their most strictly aligned component. The size of any object, including aggregates and unions, shall always be a multiple of the object's alignment. An array uses the same alignment as its elements. Structure and union objects may require padding to meet size and element constraints. The contents of such padding is undefined.

A conforming application shall not read padding.

Figure 2-1. Structure Smaller Than A Word

    struct {
        char c;
    }
   
Byte aligned, sizeof is 1
OffsetByte 0
0c0

Figure 2-2. No Padding

    struct {
        char  c;
        char  d;
        short s;
        int   i;
        long  l;
    }
   
Doubleword Aligned, sizeof is 16
OffsetByte 3Byte 2Byte 1Byte 0
0s2d1c0
4i0
8l0
12 

Figure 2-3. Internal and Tail Padding

    struct {
        char  c;
        long  l;
        int   i;
        short s;
    }
   
Doubleword Aligned, sizeof is 24
OffsetByte 3Byte 2Byte 1Byte 0
0pad1c0
4pad1
8l0
12 
16i0
20pad2s0

Bit Fields

C struct and union definitions may have bit-fields, which define integral objects with a specified number of bits.

Bit fields that are declared with neither signed nor unsigned specifier shall always be treated as unsigned. Bit fields obey the same size and alignment rules as other structure and union members, with the following additional properties:

Figure 2-4. Bit-Field Ranges

Bit-field TypeWidth wRange
signed char
char
unsigned char
     
1 to 8
-2w-1 to 2w-1-1
0 to 2w-1
0 to 2w-1
     
signed short
short
unsigned short
     
1 to 16
-2w-1 to 2w-1-1
0 to 2w-1
0 to 2w-1
     
signed int
int
unsigned int
     
1 to 32
-2w-1 to 2w-1-1
0 to 2w-1
0 to 2w-1
     
signed long
long
unsigned long
     
1 to 64
-2w-1 to 2w-1-1
0 to 2w-1
0 to 2w-1