File tree Expand file tree Collapse file tree 1 file changed +15
-21
lines changed Expand file tree Collapse file tree 1 file changed +15
-21
lines changed Original file line number Diff line number Diff line change @@ -655,33 +655,27 @@ end
655655
656656function bitonicfirststage! (v, :: Val{Gap} , o:: Ordering ) where Gap
657657 N = length (v)
658- @inbounds begin
659- gap = 1 << Gap
660- g2 = gap >> 1
661- for i in 0 : gap: N- 1
662- firstj = max (0 , i + gap - N)
663- for j in firstj: (g2- 1 )
664- ia = i + j
665- ib = i + gap - j - 1
666- @inbounds comparator! (v, ia + 1 , ib + 1 , o)
667- end
658+ gap = 1 << Gap
659+ halfgap = 1 << (Gap - 1 )
660+ for i in 0 : gap: N- 1
661+ firstj = max (0 , i + gap - N)
662+ for j in firstj: (halfgap- 1 )
663+ ia = i + j
664+ ib = i + gap - j - 1
665+ @inbounds comparator! (v, ia + 1 , ib + 1 , o)
668666 end
669667 end
670668end
671669
672670function bitonicsecondstage! (v, :: Val{Gap} , o:: Ordering ) where Gap
673671 N = length (v)
674- @inbounds begin
675- for n in Gap: - 1 : 1
676- gap = 1 << n
677- for i in 0 : gap: N- 1
678- lastj = min (N - 1 , N - (i + gap >> 1 + 1 ))
679- for j in 0 : lastj
680- ia = i + j
681- ib = i + j + gap >> 1
682- @inbounds comparator! (v, ia + 1 , ib + 1 , o)
683- end
684- end
672+ gap = 1 << Gap
673+ for i in 0 : gap: N- 1
674+ lastj = min (N - 1 , N - (i + gap >> 1 + 1 ))
675+ for j in 0 : lastj
676+ ia = i + j
677+ ib = i + j + gap >> 1
678+ @inbounds comparator! (v, ia + 1 , ib + 1 , o)
685679 end
686680 end
687681end
You can’t perform that action at this time.
0 commit comments