mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:05:49 +00:00
[SHELL/EXPERIMENTS]
* Create a branch for some evul shell experiments. svn path=/branches/shell-experiments/; revision=61927
This commit is contained in:
parent
d09f611410
commit
527f2f9057
20177 changed files with 0 additions and 1312061 deletions
36
lib/sdk/crt/mem/memcpy.c
Normal file
36
lib/sdk/crt/mem/memcpy.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include <string.h>
|
||||
|
||||
/* NOTE: This code is a duplicate of memmove implementation! */
|
||||
void* memcpy(void* dest, const void* src, size_t count)
|
||||
{
|
||||
char *char_dest = (char *)dest;
|
||||
char *char_src = (char *)src;
|
||||
|
||||
if ((char_dest <= char_src) || (char_dest >= (char_src+count)))
|
||||
{
|
||||
/* non-overlapping buffers */
|
||||
while(count > 0)
|
||||
{
|
||||
*char_dest = *char_src;
|
||||
char_dest++;
|
||||
char_src++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* overlaping buffers */
|
||||
char_dest = (char *)dest + count - 1;
|
||||
char_src = (char *)src + count - 1;
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
*char_dest = *char_src;
|
||||
char_dest--;
|
||||
char_src--;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue