O'Reilly logo

The Definitive Guide to ARM® Cortex®-M0 and Cortex-M0+ Processors, 2nd Edition by Joseph Yiu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.4. Data Type Conversion

The Cortex®-M processors support a number of instructions for converting data between different data types.

6.4.1. Conversion of Data Size

On compilers for ARM® architecture, different data types have different sizes. A number of commonly used data types and its corresponding sizes on ARM compilers are shown in the following table (Table 6.7).

Table 6.7

Size of commonly used data types in C language for ARM® architecture

C data typeNumber of bits
“char”, “unsigned char”8
“enum”8/16/32 (Smallest is chosen)
“short”, “unsigned short”16
“int”, “unsigned int”32
“long”, “unsigned long”32
When converting a data value from one type to another type with a larger size, we need to sign extend or zero extend it. A number of instructions are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required