From 8d508150bf0e1f165566e20aa9d5e902c1c08562 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 1 Oct 2014 18:16:54 -0400 Subject: [PATCH] Remove uint_mapping. Fixes #8539 Moved to SortingAlgorithms.jl in JuliaLang/SortingAlgorithms.jl@ce5c2bd168a3f43bf69cfcc506bccdd813e69494 --- base/ordering.jl | 27 +-------------------------- base/sort.jl | 2 +- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/base/ordering.jl b/base/ordering.jl index cdd8b2975043e..79013e8408a2e 100644 --- a/base/ordering.jl +++ b/base/ordering.jl @@ -7,7 +7,7 @@ export # not exported by Base By, Lt, Perm, ReverseOrdering, ForwardOrdering, LexicographicOrdering, DirectOrdering, - lt, uint_mapping, ord, ordtype + lt, ord, ordtype abstract Ordering @@ -57,31 +57,6 @@ function lt(p::Perm{LexicographicOrdering}, a::Int, b::Int) c != 0 ? c < 0 : a < b end -# Map a bits-type to an unsigned int, maintaining sort order -uint_mapping(::ForwardOrdering, x::Unsigned) = x -uint_mapping(::ForwardOrdering, x::Int8) = uint8 (x $ typemin(Int8)) -uint_mapping(::ForwardOrdering, x::Int16) = uint16 (x $ typemin(Int16)) -uint_mapping(::ForwardOrdering, x::Int32) = uint32 (x $ typemin(Int32)) -uint_mapping(::ForwardOrdering, x::Int64) = uint64 (x $ typemin(Int64)) -uint_mapping(::ForwardOrdering, x::Int128) = uint128(x $ typemin(Int128)) -uint_mapping(::ForwardOrdering, x::Float32) = (y = reinterpret(Int32, x); uint32(y < 0 ? ~y : (y $ typemin(Int32)))) -uint_mapping(::ForwardOrdering, x::Float64) = (y = reinterpret(Int64, x); uint64(y < 0 ? ~y : (y $ typemin(Int64)))) - -uint_mapping{Fwd}(::ReverseOrdering{Fwd}, x) = ~uint_mapping(Fwd, x) -#uint_mapping{T<:Real}(::ReverseOrdering{ForwardOrdering}, x::T) = ~uint_mapping(Forward, x) ## Manually inlined -uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Unsigned) = ~x -uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Int8) = ~uint8 (x $ typemin(Int8)) -uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Int16) = ~uint16 (x $ typemin(Int16)) -uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Int32) = ~uint32 (x $ typemin(Int32)) -uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Int64) = ~uint64 (x $ typemin(Int64)) -uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Int128) = ~uint128(x $ typemin(Int128)) -uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Float32) = (y = reinterpret(Int32, x); uint32(y < 0 ? y : ~(y $ typemin(Int32)))) -uint_mapping(::ReverseOrdering{ForwardOrdering}, x::Float64) = (y = reinterpret(Int64, x); uint64(y < 0 ? y : ~(y $ typemin(Int64)))) - -uint_mapping(o::By, x ) = uint_mapping(Forward, o.by(x)) -uint_mapping(o::Perm, i::Int) = uint_mapping(o.order, o.data[i]) -uint_mapping(o::Lt, x ) = error("uint_mapping does not work with general Lt Orderings") - ordtype(o::ReverseOrdering, vs::AbstractArray) = ordtype(o.fwd, vs) ordtype(o::Perm, vs::AbstractArray) = ordtype(o.order, o.data) # TODO: here, we really want the return type of o.by, without calling it diff --git a/base/sort.jl b/base/sort.jl index 12529f1090ed5..deff7d69ac7a8 100644 --- a/base/sort.jl +++ b/base/sort.jl @@ -367,7 +367,7 @@ using ...Order import Core.Intrinsics: unbox, slt_int import ..Sort: sort! -import ...Order: lt, DirectOrdering, uint_mapping +import ...Order: lt, DirectOrdering typealias Floats Union(Float32,Float64)