分类:
2007-09-20 19:39:55
void* mymemcpy( void* dest, const void* src, size_t count )
{
char* d = (char*)dest;
const char* s = (const char*)src;
int n = (count + 7) / 8; // count > 0 assumed
switch( count & 7 )
{
case 0: do { *d++ = *s++;
case 7: *d++ = *s++;
case 6: *d++ = *s++;
case 5: *d++ = *s++;
case 4: *d++ = *s++;
case 3: *d++ = *s++;
case 2: *d++ = *s++;
case 1: *d++ = *s++;
} while (--n > 0);
}
return dest;
}
这样也行,真是长见识了~_~
哪位大牛解释下???