- void *mymemcpy(void *dst,const void *src,size_t num)
- {
- assert((dst!=NULL)&&(src!=NULL));
- int wordnum = num/4;//计算有多少个32位,按4字节拷贝
- int slice = num%4;//剩余的按字节拷贝
- int * pintsrc = (int *)src;
- int * pintdst = (int *)dst;
- while(wordnum--)*pintdst++ = *pintsrc++;
- while (slice--)*((char *)pintdst++) =*((char *)pintsrc++);
- return dst;
- }