4242
4343# Map a bits-type to an unsigned int, maintaining sort order
4444uint_mapping (:: ForwardOrdering , x:: Unsigned ) = x
45- for (signedty, unsignedty) in ((Int8, Uint8 ), (Int16, Uint16 ), (Int32, Uint32 ), (Int64, Uint64 ), (Int128, Uint128 ))
45+ for (signedty, unsignedty) in ((Int8, UInt8 ), (Int16, UInt16 ), (Int32, UInt32 ), (Int64, UInt64 ), (Int128, UInt128 ))
4646 # In Julia 0.4 we can just use unsigned() here
4747 @eval uint_mapping (:: ForwardOrdering , x:: $signedty ) = reinterpret ($ unsignedty, x $ typemin (typeof (x)))
4848end
49- uint_mapping (:: ForwardOrdering , x:: Float32 ) = (y = reinterpret (Int32, x); reinterpret (Uint32 , ifelse (y < 0 , ~ y, y $ typemin (Int32))))
50- uint_mapping (:: ForwardOrdering , x:: Float64 ) = (y = reinterpret (Int64, x); reinterpret (Uint64 , ifelse (y < 0 , ~ y, y $ typemin (Int64))))
49+ uint_mapping (:: ForwardOrdering , x:: Float32 ) = (y = reinterpret (Int32, x); reinterpret (UInt32 , ifelse (y < 0 , ~ y, y $ typemin (Int32))))
50+ uint_mapping (:: ForwardOrdering , x:: Float64 ) = (y = reinterpret (Int64, x); reinterpret (UInt64 , ifelse (y < 0 , ~ y, y $ typemin (Int64))))
5151
5252uint_mapping {Fwd} (rev:: ReverseOrdering{Fwd} , x) = ~ uint_mapping (rev. fwd, x)
5353uint_mapping {T<:Real} (:: ReverseOrdering{ForwardOrdering} , x:: T ) = ~ uint_mapping (Forward, x) # maybe unnecessary; needs benchmark
@@ -71,7 +71,7 @@ function sort!(vs::AbstractVector, lo::Int, hi::Int, ::RadixSortAlg, o::Ordering
7171
7272 # Init
7373 iters = ceil (Integer, sizeof (T)* 8 / RADIX_SIZE)
74- bin = zeros (Uint32 , 2 ^ RADIX_SIZE, iters)
74+ bin = zeros (UInt32 , 2 ^ RADIX_SIZE, iters)
7575 if lo > 1 ; bin[1 ,:] = lo- 1 ; end
7676
7777 # Histogram for each element, radix
0 commit comments