Skip to content

Commit 6c7f401

Browse files
committed
_sort
1 parent c04570b commit 6c7f401

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/plan.jl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,20 @@ Base.size(p::FFTAPlan{<:Any,N}) where N = ntuple(Base.Fix1(size, p), Val{N}())
4949
Base.complex(p::FFTAPlan_re{T,N,R}) where {T,N,R} = FFTAPlan_cx{T,N,R}(p.callgraph, p.region, p.dir, p.pinv)
5050

5151
function _sort(region::T)::T where {N,T<:NTuple{N,Int}}
52-
if N == 2
53-
minmax(region[1], region[2])
54-
elseif N == 3
55-
t1, t2, t3 = region
56-
t1, t2 = minmax(t1, t2)
57-
t2, t3 = minmax(t2, t3)
58-
t1, t2 = minmax(t1, t2)
59-
return (t1, t2, t3)
52+
@static if VERSION >= v"1.12"
53+
sort(region)
6054
else
61-
@static VERSION >= v"1.12" ? sort(region) : NTuple{N}(sort!(collect(region)))
55+
if N == 2
56+
minmax(region[1], region[2])
57+
elseif N == 3
58+
t1, t2, t3 = region
59+
t1, t2 = minmax(t1, t2)
60+
t2, t3 = minmax(t2, t3)
61+
t1, t2 = minmax(t1, t2)
62+
(t1, t2, t3)
63+
else
64+
NTuple{N}(sort!(collect(region)))
65+
end
6266
end
6367
end
6468

0 commit comments

Comments
 (0)