Decompile strlen
This commit is contained in:
parent
2b96f793d3
commit
9cb9a9b4d7
|
|
@ -13,7 +13,7 @@ f32 sinf(f32 arg0);
|
|||
f32 sqrtf(f32 arg0);
|
||||
|
||||
void *memcpy(void *, const void *, size_t);
|
||||
u32 strlen(char *str);
|
||||
size_t strlen(const char *s);
|
||||
char *strchr(const char *s, int c);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,21 +17,16 @@ glabel memcpy
|
|||
/* 4a608: 00801025 */ or $v0,$a0,$zero
|
||||
);
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel strlen
|
||||
/* 4a60c: 908e0000 */ lbu $t6,0x0($a0)
|
||||
/* 4a610: 00801825 */ or $v1,$a0,$zero
|
||||
/* 4a614: 11c00005 */ beqz $t6,.L0004a62c
|
||||
/* 4a618: 00000000 */ nop
|
||||
/* 4a61c: 906f0001 */ lbu $t7,0x1($v1)
|
||||
.L0004a620:
|
||||
/* 4a620: 24630001 */ addiu $v1,$v1,0x1
|
||||
/* 4a624: 55e0fffe */ bnezl $t7,.L0004a620
|
||||
/* 4a628: 906f0001 */ lbu $t7,0x1($v1)
|
||||
.L0004a62c:
|
||||
/* 4a62c: 03e00008 */ jr $ra
|
||||
/* 4a630: 00641023 */ subu $v0,$v1,$a0
|
||||
);
|
||||
size_t strlen(const char *s)
|
||||
{
|
||||
const char *sc = s;
|
||||
|
||||
while (*sc) {
|
||||
sc++;
|
||||
}
|
||||
|
||||
return sc - s;
|
||||
}
|
||||
|
||||
char *strchr(const char *s, int c)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue