All pastes #2131047 Raw Edit

Miscellany

public text v1 · immutable
#2131047 ·published 2012-03-22 06:26 UTC
rendered paste body
        .file   "mystrlen.c"
        .text
.globl mystrlen
        .type   mystrlen, @function
mystrlen:
        movq    $0 , %rax               # set return value to 0 
while:
        movq    (%rdi), %rsi    # read bytes from memory
        cmpq    %rsi , 0        # compares value pointed to by first arg to zero 
        je      end             # return if value is zero 
                                # else 
        incq    %rax            # increment return value by 1 
        incq    %rdi            # increment string pointer by 1 
        jmp     while           # return to while 
end:
        ret