diff options
Diffstat (limited to 'euler/source/euler/gcc.asm')
-rw-r--r-- | euler/source/euler/gcc.asm | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/euler/source/euler/gcc.asm b/euler/source/euler/gcc.asm new file mode 100644 index 0000000..6fc6fd5 --- /dev/null +++ b/euler/source/euler/gcc.asm @@ -0,0 +1,53 @@ +bits 64 + +global strlen + +section .text + +strlen: + xor rax, rax +.loop: + mov rdx, qword [rdi] + test edx, 0xff + jz .plus0 + test edx, 0xff00 + jz .plus1 + test edx, 0xff0000 + jz .plus2 + test edx, 0xff000000 + jz .plus3 + shr rdx, 32 + test edx, 0xff + jz .plus4 + test edx, 0xff00 + jz .plus5 + test edx, 0xff0000 + jz .plus6 + test edx, 0xff000000 + jz .plus7 + add rax, 8 + add rdi, 8 + jmp .loop +.plus0: + ret +.plus1: + add rax, 1 + ret +.plus2: + add rax, 2 + ret +.plus3: + add rax, 3 + ret +.plus4: + add rax, 4 + ret +.plus5: + add rax, 5 + ret +.plus6: + add rax, 6 + ret +.plus7: + add rax, 7 + ret |