PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
strspn.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
14size_t strspn(const char *s, const char *accept)
15{
16 const char *v2;
17
18 v2 = s;
19 if (*s)
20 {
21 const char *v3;
22
23 v3 = accept;
24 do
25 {
26 int v4;
27
28 v4 = *(u8 *)v3 << 24;
29 if (!*v3)
30 {
31 break;
32 }
33 do
34 {
35 if (v4 >> 24 == *s)
36 {
37 break;
38 }
39 v4 = *(u8 *)++v3 << 24;
40 }
41 while (*v3);
42 if (!*v3)
43 {
44 break;
45 }
46 s += 1;
47 v3 = accept;
48 }
49 while (*s);
50 }
51 return s - v2;
52}