PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
memset.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 *memset(void *ptr, int c, size_t size)
15{
16 if (ptr)
17 {
18 u8 *i;
19
20 if (!c && (((((u32)ptr) & 0xff) | (u8)size) & 3) == 0)
21 {
22 return _wmemset((u32 *)ptr, 0, size);
23 }
24 for (i = ptr; size > 0; i += 1)
25 {
26 *i = c;
27 size -= 1;
28 }
29 }
30 return ptr;
31}