Start moving string.c to libretro-sdk/crt

This commit is contained in:
twinaphex 2014-10-25 06:14:24 +02:00
parent 1b63de1d02
commit 753f27c67c
3 changed files with 35 additions and 26 deletions

34
libretro-sdk/crt/string.c Normal file
View File

@ -0,0 +1,34 @@
#ifdef _MSC_VER
#include <cruntime.h>
#endif
#include <stdio.h>
#include <string.h>
void *memset(void *dst, int val, size_t count)
{
void *start = dst;
#if defined(_M_IA64) || defined (_M_AMD64) || defined(_M_ALPHA) || defined (_M_PPC)
extern void RtlFillMemory(void *, size_t count, char);
RtlFillMemory(dst, count, (char)val);
#else
while (count--)
{
*(char*)dst = (char)val;
dst = (char*)dst + 1;
}
#endif
return start;
}
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;
}

View File

@ -30,7 +30,7 @@ CFLAGS += -Wall -O2 -ffreestanding -std=gnu99 $(MACHDEP) $(INCLUDE)
LDFLAGS := -T link.ld
OBJ = crt0.o dolloader.o elfloader.o main.o string.o sync.o
OBJ = crt0.o dolloader.o elfloader.o main.o ../../libretro-sdk/crt/string.o sync.o
all: $(BIN_TARGET)

View File

@ -1,25 +0,0 @@
// 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;
}