调整指针长度,扩大赋值范围以及其它关于类型的问题

一、
int aa[2][3][2]={{{1,2},{3,4},{5,6}},{{7,8},{9,10},{1,2}}};
__int64 b=*(__int64*)aa[1][2];
__int64 a;
a=b>>32;//高位
printf("%d\n",a);
int c;
c=(int)b;//低位
printf("%d\n",c);
输出:2
     1
二、
int a=0x0101;
short b;
b=a;
这样赋值连个warning都没有,是无一点问题的。
同样地:
int a=0x41;
unsigned char b;
b=a;
这样也是OK的。
 
三、
设dst是一个指向short指针,那个它只能16位地移动 ,如果:
(*int)dst[0]=val;
(*int)dst[1]=val;
这样指针能32位地移动。
结合赋值可以有:
int8_t ref[2][48];
dst=&h->mb.cache.ref[i_list][X264_SCAN8_0+x+8*y]
((uint32_t*)dst)[0] = val2;
posted @ 2013-02-24 13:18  yurius  阅读(190)  评论(0编辑  收藏  举报