MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / strcmp

Function strcmp

src/PowerPC_EABI_Support/src/MSL_C/MSL_Common/string.c:114–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114int strcmp(const char* str1, const char* str2)
115{
116 // bless metrowerks for this implementation
117
118 register u8* left = (u8*)str1;
119 register u8* right = (u8*)str2;
120 u32 align, l1, r1, x;
121
122 u32 K1, K2;
123
124 l1 = *left;
125 r1 = *right;
126 if (l1 - r1) {
127 return (l1 - r1);
128 }
129
130 if ((align = ((int)left & 3)) != ((int)right & 3)) {
131 goto bytecopy;
132 }
133 if (align) {
134 if (l1 == 0) {
135 return 0;
136 }
137 for (align = 3 - align; align; align--) {
138 l1 = *(++left);
139 r1 = *(++right);
140 if (l1 - r1) {
141 return (l1 - r1);
142 }
143 if (l1 == 0) {
144 return 0;
145 }
146 }
147 left++;
148 right++;
149 }
150
151 l1 = *(int*)left;
152 r1 = *(int*)right;
153
154 K1 = 0x80808080;
155 K2 = 0xFEFEFEFF;
156
157 x = l1 + K2;
158 if (x & K1) {
159 goto adjust;
160 }
161 while (l1 == r1) {
162 l1 = *(++((int*)(left)));
163 r1 = *(++((int*)(right)));
164 x = l1 + K2;
165 if (x & K1) {
166 goto adjust;
167 }
168 }
169 if (l1 > r1)
170 return 1;
171 return -1;

Callers 15

zEntSimpleObj_InitFunction · 0.85
ResetMethod · 0.85
PlayerAbsControlFunction · 0.85
JumpApexCheckFunction · 0.85
FallCheckFunction · 0.85
MeleeCheckFunction · 0.85
StunBubbleTrailFunction · 0.85
BubbleBashContrailsFunction · 0.85
BubbleBounceContrailsFunction · 0.85
zEntPlayer_StreakFXFunction · 0.85
zEntPlayer_MoveInfoFunction · 0.85
zEntPlayer_AnimTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected