42
42
43
43
# Map a bits-type to an unsigned int, maintaining sort order
44
44
uint_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 ))
46
46
# In Julia 0.4 we can just use unsigned() here
47
47
@eval uint_mapping (:: ForwardOrdering , x:: $signedty ) = reinterpret ($ unsignedty, x $ typemin (typeof (x)))
48
48
end
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))))
51
51
52
52
uint_mapping {Fwd} (rev:: ReverseOrdering{Fwd} , x) = ~ uint_mapping (rev. fwd, x)
53
53
uint_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
71
71
72
72
# Init
73
73
iters = ceil (Integer, sizeof (T)* 8 / RADIX_SIZE)
74
- bin = zeros (Uint32 , 2 ^ RADIX_SIZE, iters)
74
+ bin = zeros (UInt32 , 2 ^ RADIX_SIZE, iters)
75
75
if lo > 1 ; bin[1 ,:] = lo- 1 ; end
76
76
77
77
# Histogram for each element, radix
0 commit comments