Skip to content

Commit

Permalink
close #74 - sort1D: merge_sort_inplace h2 > matx
Browse files Browse the repository at this point in the history
  • Loading branch information
cyriax0 committed Feb 1, 2021
1 parent 07c3c9e commit 42dbac7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/modules/gfx_sort1D_algos.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,19 @@ static int quick_sortLR(){
static int merge_sort_inplace(){
CONTINUE(1);
for (step=1;step<n;step*=2){
for (i=0;i+step<n;i+=2*step){
l=i;
r=i+step;
for (j=i;(j<i+2*step)&&(j<n)&&(l<r)&&(r<i+2*step);j++){
for (start=0;start+step<n;start+=2*step){
l=start;
r=start+step;
end = start+2*step;
if (end > n) end = n;
for (j=start;j<end;j++){
if (l>=r) break;
if (r>=end) break;
h1=l;h2=r;
YIELD(1);
if (data[l] < data[r]){
l++; continue;
l++;
continue;
}
last=data[r];
for (ll=r-1;ll>=l;ll--) data[ll+1]=data[ll];
Expand Down

0 comments on commit 42dbac7

Please sign in to comment.