/*==================================
函数: CopyBuffer
说明: 从源内存区向目标内存区顺序拷贝一定长度的内存块
入口: *SouPointer--源指针
*DesPointer--目标指针
Length-------拷贝长度
出口:返回目的区的指针
===================================*/
CopyBuffer(void *SouPointer,void *DesPointer,uint16 Length)
{
uint16 i;
uint8 *D_Pointer;
uint8 *S_Pointer;
if ( (SouPointer==NULL)||(DesPointer==NULL) )
{
return;
}
if(DesPointer < SouPointer)
{
D_Pointer = (uint8 *)DesPointer;
S_Pointer = (uint8 *)SouPointer;
for (i = 0; i < Length; i++ )
{
*D_Pointer++ = *S_Pointer++ ;
}
}
else
{
D_Pointer = ((uint8 *)DesPointer)+(Length - 1);
S_Pointer = ((uint8 *)SouPointer)+(Length - 1);
for(i = 0; i < Length; i )
{
*D_Pointer-- = *S_Pointer--;
}
}
return DesPointer;
}
文章评论(0条评论)
登录后参与讨论