Compare commits
No commits in common. "d6c9bcb9e0812993339d007987ab2c4632639e78" and "8e571d50af054c447efc2e3fb59c3ed143fba6d9" have entirely different histories.
d6c9bcb9e0
...
8e571d50af
40
cv2.asm
40
cv2.asm
@ -11,53 +11,13 @@ segment .text
|
|||||||
getSorted:
|
getSorted:
|
||||||
enter 0,0
|
enter 0,0
|
||||||
|
|
||||||
mov eax,[ebp+12]
|
|
||||||
shl eax,2
|
|
||||||
push eax
|
|
||||||
CEXTERN malloc
|
|
||||||
call malloc
|
|
||||||
add esp,4
|
|
||||||
|
|
||||||
mov ecx,[ebp+12]
|
|
||||||
mov esi,[ebp+8]
|
|
||||||
mov edi,eax
|
|
||||||
.cpy:
|
|
||||||
fld tword [esi]
|
fld tword [esi]
|
||||||
add esi,10
|
|
||||||
fstp dword [edi]
|
fstp dword [edi]
|
||||||
add edi,4
|
|
||||||
loop .cpy
|
|
||||||
|
|
||||||
;for(unsigned int i = 0; i < N ; i++)
|
;for(unsigned int i = 0; i < N ; i++)
|
||||||
; for(unsigned int j = i + 1; j < N; j++)
|
; for(unsigned int j = i + 1; j < N; j++)
|
||||||
; if (newArr[i] > newArr[j]) SWAP newArr[i],newArr[j]
|
; if (newArr[i] > newArr[j]) SWAP newArr[i],newArr[j]
|
||||||
|
|
||||||
xor esi,esi ; esi = i = 0
|
|
||||||
.for1:
|
|
||||||
cmp esi,[ebp+12]
|
|
||||||
jae .end_for1
|
|
||||||
lea edi,[esi+1] ; edi = j = i + 1
|
|
||||||
.for2:
|
|
||||||
cmp edi,[ebp+12]
|
|
||||||
jae .end_for2
|
|
||||||
|
|
||||||
fld dword [eax + esi*4]
|
|
||||||
fld dword [eax + edi*4]
|
|
||||||
fcomi
|
|
||||||
jbe .no_swap
|
|
||||||
fst dword [eax + esi*4]
|
|
||||||
fxch
|
|
||||||
fst dword [eax + edi*4]
|
|
||||||
.no_swap:
|
|
||||||
fcompp
|
|
||||||
inc edi
|
|
||||||
jmp .for2
|
|
||||||
.end_for2:
|
|
||||||
|
|
||||||
inc esi
|
|
||||||
jmp .for1
|
|
||||||
.end_for1:
|
|
||||||
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user