From 2fe0d94644b254dd884cc85fb737769734b9b91d Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Fri, 12 Jun 2015 04:57:06 -0700 Subject: [PATCH] Move setindex! with Colon from array.jl to arraymath.jl hopefully fixes win64 inference freeze --- base/array.jl | 14 -------------- base/arraymath.jl | 16 ++++++++++++++++ base/intset.jl | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/base/array.jl b/base/array.jl index 614dfe5563efa..e8b94ce096567 100644 --- a/base/array.jl +++ b/base/array.jl @@ -343,20 +343,6 @@ function setindex!(A::Array, X::AbstractArray, I::AbstractVector{Int}) end return A end -function setindex!(A::Array, x, ::Colon) - for i in 1:length(A) - @inbounds A[i] = x - end - return A -end -function setindex!(A::Array, X::AbstractArray, ::Colon) - setindex_shape_check(X, length(A)) - i = 0 - for x in X - @inbounds A[i+=1] = x - end - return A -end # Faster contiguous setindex! with copy! setindex!{T}(A::Array{T}, X::Array{T}, I::UnitRange{Int}) = (checkbounds(A, I); unsafe_setindex!(A, X, I)) diff --git a/base/arraymath.jl b/base/arraymath.jl index efd6b3b768d99..564eaab9706e5 100644 --- a/base/arraymath.jl +++ b/base/arraymath.jl @@ -1,5 +1,21 @@ # This file is a part of Julia. License is MIT: http://julialang.org/license +## setindex! with Colon +function setindex!(A::Array, x, ::Colon) + for i in 1:length(A) + @inbounds A[i] = x + end + return A +end +function setindex!(A::Array, X::AbstractArray, ::Colon) + setindex_shape_check(X, length(A)) + i = 0 + for x in X + @inbounds A[i+=1] = x + end + return A +end + ## Unary operators ## function conj!{T<:Number}(A::AbstractArray{T}) diff --git a/base/intset.jl b/base/intset.jl index 64192c9e6cfcb..c0811797a80e1 100644 --- a/base/intset.jl +++ b/base/intset.jl @@ -113,7 +113,7 @@ symdiff(s1::IntSet, s2::IntSet) = (s1.limit >= s2.limit ? symdiff!(copy(s1), s2) : symdiff!(copy(s2), s1)) function empty!(s::IntSet) - s.bits[:] = 0 + fill!(s.bits, 0) return s end