ARM 處理器支持6種數據類型;
8位有符號和無符號字節。 (char, unsigned char)
16位有符號和無符號半字,它們以2字節的邊界對准。(short int, unsigned short int)
32位有符號和無符號字,它們以4字節的邊界對准。(int, unsigned int)
ARM指令全是以32bit的字並且必須是字對准的。
Thumb指令是半字而且必以兩字節的邊界對准的。
- #include <stdio.h>
- #include <stdlib.h>
-
- void main()
- {
- printf("sizeof(char) = %d\n", sizeof(char));
- printf("sizeof(short) = %d\n", sizeof(short));
- printf("sizeof(int) = %d\n", sizeof(int));
- printf("sizeof(long) = %d\n", sizeof(long));
- printf("sizeof(float) = %d\n", sizeof(float));
- printf("sizeof(double) = %d\n", sizeof(double));
運行結果:
- [[email protected] width]# arm-linux-gcc arm-width.c -o arm-width
- [[email protected] width]# ./arm-width
- sizeof(char) = 1
- sizeof(short) = 2
- sizeof(int) = 4
- sizeof(long) = 4
- sizeof(float) = 4
- sizeof(double) = 8
- [[email protected] width]#