diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-04-06 10:11:07 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-04-06 10:11:07 +0800 |
| commit | f3e040230772f978540a71aea43dfde200992922 (patch) | |
| tree | bd8ca31b72dd01e24980b073854e263589530f56 /libpsn00b/libc/memcmp.s | |
| download | psn00bsdk-f3e040230772f978540a71aea43dfde200992922.tar.gz | |
First commit
Diffstat (limited to 'libpsn00b/libc/memcmp.s')
| -rw-r--r-- | libpsn00b/libc/memcmp.s | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libpsn00b/libc/memcmp.s b/libpsn00b/libc/memcmp.s new file mode 100644 index 0000000..b8b495d --- /dev/null +++ b/libpsn00b/libc/memcmp.s @@ -0,0 +1,31 @@ +# High speed ASM memcmp implementation by Lameguy64 +# +# Part of PSn00bSDK + +.set noreorder + +.section .text + +# Arguments: +# a0 - buffer 1 address +# a1 - buffer 2 address +# a2 - bytes to compare +.global memcmp +.type memcmp, @function +memcmp: + blez $a2, .exit + addi $a2, -1 + lbu $v0, 0($a0) + lbu $v1, 0($a1) + addiu $a0, 1 + bne $v0, $v1, .mismatch + addiu $a1, 1 + b memcmp + nop +.mismatch: + jr $ra + sub $v0, $v1 +.exit: + jr $ra + move $v0, $0 +
\ No newline at end of file |
