From 753f27c67c9c09369f9e8c9fda3daada9cd5a487 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 25 Oct 2014 06:14:24 +0200 Subject: [PATCH] Start moving string.c to libretro-sdk/crt --- libretro-sdk/crt/string.c | 34 ++++++++++++++++++++++++++++++++++ wii/app_booter/Makefile | 2 +- wii/app_booter/string.c | 25 ------------------------- 3 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 libretro-sdk/crt/string.c delete mode 100644 wii/app_booter/string.c diff --git a/libretro-sdk/crt/string.c b/libretro-sdk/crt/string.c new file mode 100644 index 0000000000..4114de11d9 --- /dev/null +++ b/libretro-sdk/crt/string.c @@ -0,0 +1,34 @@ +#ifdef _MSC_VER +#include +#endif +#include +#include + +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; +} diff --git a/wii/app_booter/Makefile b/wii/app_booter/Makefile index ea13bfa32a..4b4e44c035 100644 --- a/wii/app_booter/Makefile +++ b/wii/app_booter/Makefile @@ -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) diff --git a/wii/app_booter/string.c b/wii/app_booter/string.c deleted file mode 100644 index 0e6b31a1e6..0000000000 --- a/wii/app_booter/string.c +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2008-2009 Segher Boessenkool -// 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 - -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; -}