- 论坛徽章:
- 0
|
10可用积分
typedef struct ctst{
unsigned short pll_iset :2,
pll_inv :2,
pll_reset :1,
pll_r :9,
rfu :2;
}TST;
int main(void)
{
unsigned short t1;
t1 = 0x0000;
((TST *)&t1)->pll_r = 0x18;
((TST *)&t1)->pll_inv = 1;
printf("the t1 = 0x%x\n",t1);
((TST *)&t1)->pll_inv = 2;
printf("the t1 = 0x%x\n",t1);
((TST *)&t1)->pll_inv = 3;
printf("the t1 = 0x%x\n",t1);
return 0;
}
在PC 上GCC编译后执行结果
the t1 = 0x304
the t1 = 0x308
the t1 = 0x30c
在ARM上arm-linux-gcc 3.4.1 编译执行结果
the t1 = 0x300
the t1 = 0x84d4
the t1 = 0x308
请高手帮忙分析一下原因
[ 本帖最后由 guode0724 于 2009-6-2 10:27 编辑 ] |
|