diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-08-13 06:23:12 +0000 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-05 16:02:29 +0100 |
| commit | 6f0ebbad84419de65a03a0ea6e41cbc6b49d6eb0 (patch) | |
| tree | f5fbeb6e3f50ebb57000f9b1aac6e3ba129d6587 /basics/string.S | |
| parent | 8e968078e6aee470a02bed7728100b2df1877e90 (diff) | |
| download | farga-6f0ebbad84419de65a03a0ea6e41cbc6b49d6eb0.tar.gz farga-6f0ebbad84419de65a03a0ea6e41cbc6b49d6eb0.zip | |
basics: Fix typo on 'palindrome'
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'basics/string.S')
| -rw-r--r-- | basics/string.S | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/basics/string.S b/basics/string.S index e04e4de..0f3bcc1 100644 --- a/basics/string.S +++ b/basics/string.S @@ -48,13 +48,13 @@ reverse_done: end: jr ra -.globl is_palyndrome -.type is_palyndrome, @function +.globl is_palindrome +.type is_palindrome, @function -// bool is_palyndrome(char *str); -is_palyndrome: +// bool is_palindrome(char *str); +is_palindrome: // Return early on null pointer. - beq a0, zero, palyndrome_no + beq a0, zero, palindrome_no // Set `t0` to point to the end of the string. add t0, a0, zero @@ -68,14 +68,14 @@ pal_set_end_ptr: // to be done and we can return early. Otherwise decrement `t0` so it points // to the byte right before the null termination. pal_end_ptr_done: - beq a0, t0, palyndrome_no + beq a0, t0, palindrome_no addi t0, t0, -1 pal_loop: // Swap values between the two pointers. lb t1, 0(a0) lb t2, 0(t0) - bne t1, t2, palyndrome_no + bne t1, t2, palindrome_no // Move pointers and check whether the pointers have already crossed. If // they have not crossed yet there is still looping to be done. Otherwise @@ -84,10 +84,10 @@ pal_loop: addi t0, t0, -1 bleu a0, t0, pal_loop -palyndrome_yes: +palindrome_yes: li a0, 1 jr ra -palyndrome_no: +palindrome_no: li a0, 0 jr ra |
