commit
e092cb029c
252 files changed
+35037
No files matched your search
@@ -0,0 +1,27 @@
|
||||
; rdi = list A rsi = |A| rdx = list B rcx = |B|
|
||||
; rax = how many values appear in both
|
||||
xor eax, eax
|
||||
xor r8, r8
|
||||
xor r9, r9
|
||||
.step:
|
||||
cmp r8, rsi
|
||||
jae .done
|
||||
cmp r9, rcx
|
||||
jae .done
|
||||
mov r10, qword ptr [rdi + r8*8]
|
||||
mov r11, qword ptr [rdx + r9*8]
|
||||
cmp r10, r11
|
||||
je .both
|
||||
jb .advanceA
|
||||
add r9, 1 ; the second list is behind
|
||||
jmp .step
|
||||
.advanceA:
|
||||
add r8, 1 ; the first list is behind
|
||||
jmp .step
|
||||
.both:
|
||||
add rax, 1
|
||||
add r8, 1
|
||||
add r9, 1
|
||||
jmp .step
|
||||
.done:
|
||||
ret
|
||||
Reference in new issue
Block a user