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