内存拷贝,注意覆盖情况 memcopy
void* memcpy(void* dsc, const void* src, int length){
assert(dsc != nullptr && src != nullptr); // 如果为假的话 断言报错
char* d;
const char* s;
if((char*)src + length < (char*)dsc || dsc < src){
d = (char*)dsc;
s = (char*)src;
while(length > 0){
*d = *s;
d++;
s++;
length--;
}
}else{
d = (char*)dsc + length - 1;
s = (char*)src + length - 1;
while(length){
*d = *s;
d--;
s--;
length--;
}
}
return dsc;
}