Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int j;
- long swapped = 0;
- long sizeSORT = ptr2[0]-2;
- long temp = 0;
- long temp2 = 0;
- long indexSORT = 0;
- long int *base = &ptr[1];
- __asm__ ("do2:\n\t"
- "movl $0, %0\n\t"
- "for2:\n\t"
- " cmpl %6, %8\n\t" //Compares indexSORT and sizeSORT
- " je endFor2\n\t" //try jle later to see if it works
- " if2:\n\t"
- " movl (%4, %8, 4), %1\n\t"
- " movl 4(%4, %8, 4), %3\n\t"
- " cmpl %1, %3\n\t"
- " jge endIf2\n\t"
- " movl %1, 4(%4, %8, 4)\n\t"
- " movl %3, (%4, %8, 4)\n\t"
- " movl $1, %0\n\t" //Sets swapped to True, thus breaks the do while-loop
- " endIf2:\n\t"
- " incl %2\n\t"
- " jmp for2\n\t"
- "endFor2:\n\t"
- " if3:\n\t"
- " cmpl $0, %5\n\t"
- " je endFor3\n\t"
- " endIf3:\n\t"
- "movl $0, %0\n\t"
- "movl %6, %2\n\t" //Can I do this?, Load sizeSORT into indexSORT
- "for3:\n\t"
- " cmpl $0, %8\n\t"
- " je endFor3\n\t"
- " if4:\n\t"
- " movl -4(%4, %8, 4), %1\n\t"
- " movl (%4, %8, 4), %3\n\t"
- " cmpl %1, %3\n\t"
- " jge endIf4\n\t"
- " movl %1, (%4, %8, 4)\n\t"
- " movl %3, -4(%4, %8, 4)\n\t"
- " endIf4:\n\t"
- " decl %2\n\t"
- " jmp for3\n\t"
- "endFor3:\n\t"
- // 0 1 2 3 4
- : "=r" (swapped), "=r" (temp), "=r" (indexSORT), "=r" (temp2), "+r" (base)
- // 5 6 7 8 9
- : "r" (swapped), "r" (sizeSORT), "r" (temp), "r" (indexSORT), "r" (base));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement