unsigned short *pwAddr = (unsigned short *)0x2;
unsigned short wVal;
wVal = *pwAddr;
例5.2 地址不对齐的16位读操作。
unsigned short *pwAddr = (unsigned short *)0x1;
unsigned short wVal;
wVal = *pwAddr;
理解:http://www.100ask.net/forum/showtopic-3663.aspx 我通过这里了解。
这语句的意思是读地址 0x2 0x3 这两个字节的数据。理解这一点。
操作系统读的方式:cpu只能按地址对齐方式读。为了读0x1地址,就得从0x0开始,得到D0,D1。
读0x2地址时,就得从0x2开始,得到D2,D3。
要得到 D1,D2,就得都读出来,在讲D1,D2挑出来。