ARM处理器支持的数据宽度

发布: 2013-06-07 10:56


ARM 处理器支持6种数据类型;

8位有符号和无符号字节。 (char, unsigned char)

16位有符号和无符号半字,它们以2字节的边界对准。(short int, unsigned short int)

32位有符号和无符号字,它们以4字节的边界对准。(int, unsigned int)

ARM指令全是以32bit的字并且必须是字对准的。

Thumb指令是半字而且必以两字节的边界对准的。

#include
#include

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));
}
运行结果:


[root@localhost width]# arm-linux-gcc arm-width.c -o arm-width
[root@localhost width]# ./arm-width
sizeof(char) = 1
sizeof(short) = 2
sizeof(int) = 4
sizeof(long) = 4
sizeof(float) = 4
sizeof(double) = 8
[root@localhost width]#



原文: http://qtchina.tk/?q=node/730

Powered by zexport