memcpy和memmove函数的比较与实现
来源:互联网 发布:闪迪u盘数据恢复软件 编辑:程序博客网 时间:2024/06/07 18:15
memcpy
代码:
;***
;memcpy.asm - contains memcpy and memmove routines
;
; Copyright (c) 1986-1997, Microsoft Corporation. All right reserved.
;
;Purpose:
; memcpy() copies a source memory buffer to a destination buffer.
; Overlapping buffers are not treated specially, so propogation may occur.
; memmove() copies a source memory buffer to a destination buffer.
; Overlapping buffers are treated specially, to avoid propogation.
;
;*******************************************************************************
;***
;memcpy - Copy source buffer to destination buffer
;
;Purpose:
; memcpy() copies a source memory buffer to a destination memory buffer.
; This routine does NOT recognize overlapping buffers, and thus can lead
; to propogation.
; For cases where propogation must be avoided, memmove() must be used.
;
; Algorithm:
void* memcpy(void* dest, void* source, size_t count)
{
void* ret = dest;
//copy from lower address to higher address
while (count--)
*dest++ = *source;
return ret;
}
memmove
memmove - Copy source buffer to destination buffer
;
;Purpose:
; memmove() copies a source memory buffer to a destination memory buffer.
; This routine recognize overlapping buffers to avoid propogation.
; For cases where propogation is not a problem, memcpy() can be used.
;
; Algorithm:
void* memmove(void* dest, void* source, size_t count)
{
void* ret = dest;
if (dest <= source || dest >= (source + count))
{
//Non-Overlapping Buffers
//copy from lower addresses to higher addresses
while (count --)
*dest++ = *source++;
}
else
{
//Overlapping Buffers
//copy from higher addresses to lower addresses
dest += count - 1;
source += count - 1;
while (count--)
*dest-- = *source--;l
}
return ret;
}
- memcpy和memmove函数的比较与实现
- memcpy和memmove函数的比较与实现
- memcpy和memmove函数的比较与实现
- memcpy和memmove函数的比较与实现
- memcpy和memmove函数的比较
- memcpy和memmove函数的比较
- memcpy函数和memmove函数的模拟实现与区别
- memcpy和memmove函数的实现
- memcpy和memmove函数的实现
- memcpy和memmove的函数内部实现
- memcpy 与memmove的比较
- memcpy和memmove的区别与实现
- memcpy和memmove的区别与实现
- memcpy和memmove的区别与实现
- 实现memcpy和memmove函数
- 实现memcpy( )和memmove( )函数
- 实现memcpy和memmove函数
- memcpy,memmove函数的实现
- 黑马程序员 Java的设计模式——单例设计模式
- Spring3之InternalResourceViewResolver
- gridview获取数据列的几种方法.txt
- iphone resize uiimage的正确方式
- 如何设置FTP的主动模式和被动模式
- memcpy和memmove函数的比较与实现
- BDA - BIOS Data Area
- Moving Beyond OpenGL 1.1 for Windows
- Delphi数组及长度
- 原来是这样,这个和C++里的一样,不过java要抛出异常了
- 用sed去除配置文件空行和注释
- 浅谈BeanNameUrlHandlerMapping
- Highcharts中文属性手册
- excel表中多位位数字设置成文本后不能自动填充问题的解决方法