Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ function vect(X...)
return T[X...]
end

size(a::Array, d::Integer) = size(a, Int(d)::Int)
function size(a::Array, d::Int)
d < 1 && error("arraysize: dimension out of range")
sz = getfield(a, :size)
return d > length(sz) ? 1 : getfield(sz, d, false) # @inbounds
end

asize_from(a::Array, n) = n > ndims(a) ? () : (size(a,n), asize_from(a, n+1)...)

allocatedinline(@nospecialize T::Type) = (@_total_meta; ccall(:jl_stored_inline, Cint, (Any,), T) != Cint(0))
Expand Down
5 changes: 0 additions & 5 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ length(B::BitArray) = B.len
size(B::BitVector) = (B.len,)
size(B::BitArray) = B.dims

@inline function size(B::BitVector, d::Integer)
d < 1 && throw_boundserror(size(B), d)
ifelse(d == 1, B.len, 1)
end

isassigned(B::BitArray, i::Int) = 1 <= i <= length(B)

IndexStyle(::Type{<:BitArray}) = IndexLinear()
Expand Down
2 changes: 1 addition & 1 deletion base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Bottom = Union{}
# Define minimal array interface here to help code used in macros:
size(a::Array) = getfield(a, :size)
length(t::AbstractArray) = (@inline; prod(size(t)))
length(a::GenericMemory) = getfield(a, :length)
size(a::GenericMemory) = (getfield(a, :length),)
throw_boundserror(A, I) = (@noinline; throw(BoundsError(A, I)))

# multidimensional getindex will be defined later on
Expand Down
7 changes: 0 additions & 7 deletions base/genericmemory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ AtomicMemory

using Core: memoryrefoffset, memoryref_isassigned # import more functions which were not essential

size(a::GenericMemory, d::Int) =
d < 1 ? error("dimension out of range") :
d == 1 ? length(a) :
1
size(a::GenericMemory, d::Integer) = size(a, convert(Int, d))
size(a::GenericMemory) = (length(a),)

IndexStyle(::Type{<:GenericMemory}) = IndexLinear()

parent(ref::GenericMemoryRef) = ref.mem
Expand Down
2 changes: 0 additions & 2 deletions base/indices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ axes1(S::Slice{<:AbstractOneTo{<:Integer}}) = S.indices
first(S::Slice) = first(S.indices)
last(S::Slice) = last(S.indices)
size(S::Slice) = (length(S.indices),)
length(S::Slice) = length(S.indices)
getindex(S::Slice, i::Int) = (@inline; @boundscheck checkbounds(S, i); i)
getindex(S::Slice, i::AbstractUnitRange{<:Integer}) = (@inline; @boundscheck checkbounds(S, i); i)
getindex(S::Slice, i::StepRange{<:Integer}) = (@inline; @boundscheck checkbounds(S, i); i)
Expand Down Expand Up @@ -420,7 +419,6 @@ axes1(S::IdentityUnitRange{<:AbstractOneTo{<:Integer}}) = S.indices
first(S::IdentityUnitRange) = first(S.indices)
last(S::IdentityUnitRange) = last(S.indices)
size(S::IdentityUnitRange) = (length(S.indices),)
length(S::IdentityUnitRange) = length(S.indices)
unsafe_length(S::IdentityUnitRange) = unsafe_length(S.indices)
getindex(S::IdentityUnitRange, i::Integer) = (@inline; @boundscheck checkbounds(S, i); convert(eltype(S), i))
getindex(S::IdentityUnitRange, i::Bool) = throw(ArgumentError("invalid index: $i of type Bool"))
Expand Down
3 changes: 0 additions & 3 deletions base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,6 @@ module IteratorsMD

size(iter::CartesianIndices) = map(length, iter.indices)

length(iter::CartesianIndices) = prod(size(iter))

# make CartesianIndices a multidimensional range
Base.step(iter::CartesianIndices) = CartesianIndex(map(step, iter.indices))

Expand Down Expand Up @@ -836,7 +834,6 @@ LogicalIndex(mask::AbstractVector{Bool}) = LogicalIndex{Int, typeof(mask)}(mask)
LogicalIndex(mask::AbstractArray{Bool, N}) where {N} = LogicalIndex{CartesianIndex{N}, typeof(mask)}(mask)
LogicalIndex{Int}(mask::AbstractArray) = LogicalIndex{Int, typeof(mask)}(mask)
size(L::LogicalIndex) = (L.sum,)
length(L::LogicalIndex) = L.sum
collect(L::LogicalIndex) = [i for i in L]
show(io::IO, r::LogicalIndex) = print(io,collect(r))
print_array(io::IO, X::LogicalIndex) = print_array(io, collect(X))
Expand Down
3 changes: 1 addition & 2 deletions base/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,8 @@ struct CodeUnits{T,S<:AbstractString} <: DenseVector{T}
CodeUnits(s::S) where {S<:AbstractString} = new{codeunit(s),S}(s)
end

length(s::CodeUnits) = ncodeunits(s.s)
sizeof(s::CodeUnits{T}) where {T} = ncodeunits(s.s) * sizeof(T)
size(s::CodeUnits) = (length(s),)
size(s::CodeUnits) = (ncodeunits(s.s),)
elsize(s::Type{<:CodeUnits{T}}) where {T} = sizeof(T)
@propagate_inbounds getindex(s::CodeUnits, i::Int) = codeunit(s.s, i)
IndexStyle(::Type{<:CodeUnits}) = IndexLinear()
Expand Down
1 change: 0 additions & 1 deletion stdlib/Random/src/Random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ struct UnsafeView{T} <: DenseArray{T,1}
len::Int
end

Base.length(a::UnsafeView) = a.len
Base.getindex(a::UnsafeView, i::Int) = unsafe_load(a.ptr, i)
Base.setindex!(a::UnsafeView, x, i::Int) = unsafe_store!(a.ptr, x, i)
Base.pointer(a::UnsafeView) = a.ptr
Expand Down