Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model flat
- .code
- comment @
- radixsort(unsigned *array, size_t size, int bit);
- edx - tab
- ecx - right_zero_index
- esi - left_one_index
- edi - bit
- @
- _radixsort proc
- push ebp
- mov ebp, esp
- push edi
- push esi
- mov edx, [ebp+8]
- mov ecx, [ebp+12]
- xor esi, esi
- mov edi, [ebp+16]
- sub ecx, 1
- jl fin
- wloop:
- oloop:
- cmp esi, [ebp+12]
- jge zloop
- bt [edx+esi*4], edi
- jc zloop
- add esi, 1
- jmp oloop
- zloop:
- cmp ecx, 0
- jl swap
- bt [edx+ecx*4], edi
- jnc swap
- sub ecx, 1
- jmp zloop
- swap:
- cmp esi, ecx
- jge rec
- mov eax, [edx+esi*4]
- xchg eax, [edx+ecx*4]
- mov [edx+esi*4], eax
- jmp wloop
- rec:
- sub edi, 1
- jl fin
- push edi
- push esi
- push edx
- call _radixsort
- add esp, 12
- add edx, esi
- mov eax, [ebp+12]
- sub eax, esi
- push edi
- push eax
- push edx
- call _radixsort
- add esp, 12
- fin:
- pop esi
- pop edi
- pop ebp
- ret
- _radixsort endp
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement