Skip to content

Commit 6174e49

Browse files
authored
Merge pull request #60 from JuliaCollections/fix-tests-on-nightly
Fix CI on nightly
2 parents d0a9007 + 0fcf5f4 commit 6174e49

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/SortingAlgorithms.jl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ end
5151
uint_mapping(::ForwardOrdering, x::Float32) = (y = reinterpret(Int32, x); reinterpret(UInt32, ifelse(y < 0, ~y, xor(y, typemin(Int32)))))
5252
uint_mapping(::ForwardOrdering, x::Float64) = (y = reinterpret(Int64, x); reinterpret(UInt64, ifelse(y < 0, ~y, xor(y, typemin(Int64)))))
5353

54+
uint_mapping(::Sort.Float.Left, x::Float16) = ~reinterpret(Int16, x)
55+
uint_mapping(::Sort.Float.Right, x::Float16) = reinterpret(Int16, x)
56+
uint_mapping(::Sort.Float.Left, x::Float32) = ~reinterpret(Int32, x)
57+
uint_mapping(::Sort.Float.Right, x::Float32) = reinterpret(Int32, x)
58+
uint_mapping(::Sort.Float.Left, x::Float64) = ~reinterpret(Int64, x)
59+
uint_mapping(::Sort.Float.Right, x::Float64) = reinterpret(Int64, x)
60+
5461
uint_mapping(rev::ReverseOrdering, x) = ~uint_mapping(rev.fwd, x)
5562
uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Real) = ~uint_mapping(Forward, x) # maybe unnecessary; needs benchmark
5663

@@ -61,18 +68,18 @@ uint_mapping(o::Lt, x ) = error("uint_mapping does not work with general L
6168
const RADIX_SIZE = 11
6269
const RADIX_MASK = 0x7FF
6370

64-
function sort!(vs::AbstractVector, lo::Int, hi::Int, ::RadixSortAlg, o::Ordering, ts=similar(vs))
71+
function sort!(vs::AbstractVector{T}, lo::Int, hi::Int, ::RadixSortAlg, o::Ordering, ts::AbstractVector{T}=similar(vs)) where T
6572
# Input checking
6673
if lo >= hi; return vs; end
6774

6875
# Make sure we're sorting a bits type
69-
T = Base.Order.ordtype(o, vs)
70-
if !isbitstype(T)
71-
error("Radix sort only sorts bits types (got $T)")
76+
OT = Base.Order.ordtype(o, vs)
77+
if !isbitstype(OT)
78+
error("Radix sort only sorts bits types (got $OT)")
7279
end
7380

7481
# Init
75-
iters = ceil(Integer, sizeof(T)*8/RADIX_SIZE)
82+
iters = ceil(Integer, sizeof(OT)*8/RADIX_SIZE)
7683
bin = zeros(UInt32, 2^RADIX_SIZE, iters)
7784
if lo > 1; bin[1,:] .= lo-1; end
7885

0 commit comments

Comments
 (0)