13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>ARM</strong> <strong>User</strong> <strong>Guide</strong>C typeSizeAlignLimitslong long6464[-2 63 , 2 63 -1]unsigned long long6464[0, 2 64 -1]float (23-bit mantissa)3232[–3.402E+38, –1.175E-38][+1.175E-38, +3.402E+38]doublelong double (52-bit mantissa)6464[-1.797E+308, -2.225E-308][+2.225E-308, +1.797E+308]_Imaginary float3232[–3.402E+38i, –1.175E-38i][+1.175E-38i, +3.402E+38i]_Imaginary double_Imaginary long double6464[-1.797E+308i, -2.225E-308i][+2.225E-308i, +1.797E+308i]_Complex float6432real part + imaginary part_Complex double_Complex long double12864real part + imaginary partpointer to data or function3232[0, 2 32 -1]1.2. Changing the Alignment: __unaligned, __packed__ and__align()Normally data, pointers and structure members are aligned according to the table in the previous section.Suppress alignmentWith the type qualifier __unaligned you can specify to suppress the alignment of objects or structuremembers. This can be useful to create compact data structures. In this case the alignment will be one bit<strong>for</strong> bit-fields or one byte <strong>for</strong> other objects or structure members.At the left side of a pointer declaration you can use the type qualifier __unaligned to mark the pointervalue as potentially unaligned.This can be useful to access externally defined data. However the compilercan generate less efficient instructions to dereference such a pointer, to avoid unaligned memory access.You can always convert a normal pointer to an unaligned pointer. Conversions from an unaligned pointerto an aligned pointer are also possible. However, the compiler will generate a warning in this situation,with the exception of the following case: when the logical type of the destination pointer is char or void,no warning will be generated.Example:struct{char c;__unaligned int i; /* aligned at offset 1 ! */} s;__unaligned int * up = & s.i;2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!