2012-01-21 21:57:41 +01:00
|
|
|
// Copyright 2008-2009 Segher Boessenkool <segher@kernel.crashing.org>
|
|
|
|
// This code is licensed to you under the terms of the GNU GPL, version 2;
|
|
|
|
// see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
void *memset(void *b, int c, size_t len)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
((unsigned char *)b)[i] = c;
|
|
|
|
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *memcpy(void *dst, const void *src, size_t len)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
((unsigned char *)dst)[i] = ((unsigned char *)src)[i];
|
|
|
|
|
|
|
|
return dst;
|
|
|
|
}
|
2012-10-13 00:25:22 +02:00
|
|
|
|
|
|
|
void *memmove(void *dst, const void *src, size_t len)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
unsigned char Current;
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
{
|
|
|
|
Current = ((unsigned char *)src)[i];
|
|
|
|
((unsigned char *)src)[i] = 0x00;
|
|
|
|
((unsigned char *)dst)[i] = Current;
|
|
|
|
}
|
|
|
|
|
|
|
|
return dst;
|
|
|
|
}
|