PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
_wmemcopy.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
14// non-standard function (not to be confused with the wchar_t related function)
15void *_wmemcopy(u32 *dest, const u32 *src, size_t size)
16{
17 void *result;
18 s32 v4;
19 s32 v5;
20 u32 v6;
21 u32 v7;
22 u32 v8;
23 u32 v9;
24
25 result = dest;
26 v4 = (u32)size >> 2;
27 if (v4 > 0)
28 {
29 v5 = 0;
30 if ((v4 & 3) == 0)
31 {
32 goto LABEL_8;
33 }
34 do
35 {
36 v6 = *src++;
37 *dest++ = v6;
38 v5 += 1;
39 }
40 while ((v4 & 3) != v5);
41 if (v5 != v4)
42 {
43LABEL_8:
44 do
45 {
46 v7 = src[1];
47 v8 = src[2];
48 v9 = src[3];
49 *dest = *src;
50 dest[1] = v7;
51 dest[2] = v8;
52 dest[3] = v9;
53 v5 += 4;
54 src += 4;
55 dest += 4;
56 }
57 while (v5 != v4);
58 }
59 }
60 return result;
61}