void send(int *to,int *from,int count)
{
int n=(count+7)/8;
switch(count%8)
{
case 7: do { *to++=*from++;
case 6: *to++=*from++;
case 5: *to++=*from++;
case 4: *to++=*from++;
case 3: *to++=*from++;
case 2: *to++=*from++;
case 1: *to++=*from++;
case 0: *to++=*from++;
}while(--n>0);
}
}
{
int n=(count+7)/8;
switch(count%8)
{
case 7: do { *to++=*from++;
case 6: *to++=*from++;
case 5: *to++=*from++;
case 4: *to++=*from++;
case 3: *to++=*from++;
case 2: *to++=*from++;
case 1: *to++=*from++;
case 0: *to++=*from++;
}while(--n>0);
}
}
这段代码在Gun c++和VC++里都编译通过了,它只不过是把from所指数组里的count个整数复制到由to指向的数组里。在第一次由switch判断后,流程交由do while控制,执行循环里的语句,而不在管case了。循环次数由n决定。
4万+

被折叠的 条评论
为什么被折叠?



