首页 > 代码库 > 实现 memcpy

实现 memcpy

void * Memcpy(void * src, void * des, int len){    char * pSrc, *pDes;    if (NULL == des || NULL == src)        return NULL;    if (src < des && (char*)src + len  >(char*)des)    {        pSrc = (char*)src + len - 1;        pDes = (char*)des + len - 1;        while (len--)        {            *pDes-- = *pSrc--;        }    }    else    {        pSrc = (char*)src;        pDes = (char*)des;        while (len--)        {            *pDes++ = *pSrc++;        }    }     return des;}

 

实现 memcpy