diff options
Diffstat (limited to 'rgo/src/fndbyte.S')
-rw-r--r-- | rgo/src/fndbyte.S | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/rgo/src/fndbyte.S b/rgo/src/fndbyte.S index 2e0ed8b..c0e4382 100644 --- a/rgo/src/fndbyte.S +++ b/rgo/src/fndbyte.S @@ -15,23 +15,22 @@ .global rgo_fndbyte rgo_fndbyte: -#if defined(__x86_64__) /* - rdi: void const * ptr - rsi: size_t num - dl: uint8_t byte + void const * ptr + size_t num + uint8_t byte */ +#if defined(__x86_64__) /* rax: Address of the current element. */ movq %rdi,%rax - /* rcx: Address of the element after the last element. */ - movq %rdi,%rcx - addq %rsi,%rcx - /* r8b: Current element. */ + /* rsi: Address of the element after the last element. */ + addq %rdi,%rsi + /* rcx: Current element. */ .loop: - cmpq %rax,%rcx + cmpq %rax,%rsi je .nfnd /* We have went through the entire array without finding the byte. */ - movb (%rax),%r8b - cmpb %r8b,%dl + movb (%rax),%cl + cmpb %cl,%dl je .fnd /* We have found the byte. */ incq %rax jmp .loop |