PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
memcpy.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
11#define SYSCLIB_DISABLE_BUILTINS
12#include <sysclib.h>
13
14void *memcpy(void *dest, const void *src, size_t size)
15{
16 void *result;
17
18 result = 0;
19 if (dest)
20 {
21 if ((((u8)((((u32)dest) & 0xff) | (((u32)src) & 0xff)) | (u8)size) & 3) != 0)
22 {
23 u8 *i;
24
25 for (i = dest; size > 0; i += 1)
26 {
27 char v5;
28
29 v5 = *(u8 *)src;
30 src = (char *)src + 1;
31 size -= 1;
32 *i = v5;
33 }
34 return dest;
35 }
36 else
37 {
38 return _wmemcopy((u32 *)dest, (const u32 *)src, size);
39 }
40 }
41 return result;
42}