//Little_endian:CPU对操作数的存储方式是低字节在低地址;(Intelx86)
//Big_endian :CPU对操作数的存储方式是低字节在高地址;
#include
using namespace std;
int CheckCPU()
{
union w
{
int a;
char b;
}c;
c.a=1;
return (c.b==1);//Little_endian(==1)
}
int main()
{
int temp;
temp=CheckCPU();
if(temp)
cout<<"Little_endian"< else
cout<<"Big_endian"< return 0;
}
阅读(806) | 评论(0) | 转发(1) |