diff options
Diffstat (limited to 'zap/source/amd64/mem/streq.S')
-rw-r--r-- | zap/source/amd64/mem/streq.S | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/zap/source/amd64/mem/streq.S b/zap/source/amd64/mem/streq.S deleted file mode 100644 index e054531..0000000 --- a/zap/source/amd64/mem/streq.S +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2022 Gabriel Jensen. -# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -# If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. - -.globl zap_streq - -zap_streq: -# Address of the current left character: -#define laddr %rdi -# Address of the current right character: -#define raddr %rsi -# Current left character: -#define lchr %al -# Current right character: -#define rchr %dl - - # Iterate over the strings: -.loop: - - # Copy the characters into registers: - movb (laddr),lchr # lchr = *laddr - movb (raddr),rchr # rchr = *raddr - - # Check if the characters are equal: - cmpb lchr,rchr # if (lchr != rchr) - jne .neq # goto neq // If not, the strings also aren't equal. - - # Check if we have reached the null-terminator: - testb lchr,lchr # if (lchr == 0x0) - jz .eq # goto eq // If so, all previous characters have compared equal, and the strings are equal. - - # Continue to the next characters: - incq laddr # ++laddr - incq raddr # ++raddr - jmp .loop # goto loop - - # The strings have compared equal: -.eq: - - movb $0xFF,%al - ret # return FF - - # The strings have compared unequal: -.neq: - - movb $0x0,%al - ret # return 0 |