结果证明:是小端存储。
#include <iostream> #include <vector> #include <stack> using namespace std; int checkCPU() { union w { int a; char b; }c; c.a = 1; return (c.b == 1);//小端返回1,大端返回0 } int main() { int flag= checkCPU(); cout<<flag<<endl; return 0; }
操作数高位存内存地址高位:
比如:
地址 数据
0x4000 0x78
0x4001 0x56
0x4002 0x34
0x4003 0x12