Skip to content

Instantly share code, notes, and snippets.

@bitRAKE
Last active May 14, 2022 19:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bitRAKE/ce7862317d789ba76ffbd3acf332f613 to your computer and use it in GitHub Desktop.
All nearest smaller values, Barbay, Fischer & Navarro (2012)
; All nearest smaller values, Barbay, Fischer & Navarro (2012)
; https://arxiv.org/abs/1009.5863
; We assume an artificial overall minimum at [rsi]
; EAX: [0,N)
mov eax,1
@0: lea edx,[rax-1]
add eax,1
jmp @1
@2: mov edx,[rdi+rdx*4]
@1: mov ecx,[rsi+rax*4-4]
cmp ecx,[rsi+rdx*4]
jc @2
mov [rdi+rax*4-4],edx
cmp eax,N
jnz @0
@bitRAKE
Copy link
Author

bitRAKE commented Mar 17, 2021

Produces array of indices in [RDI].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment