diff --git a/base/bitarray.jl b/base/bitarray.jl index 94bb94e5a4d03..acc96f7284a54 100644 --- a/base/bitarray.jl +++ b/base/bitarray.jl @@ -1394,7 +1394,7 @@ function bitcount(Bc::Vector{UInt64}; init::T=0) where {T} return n end -count(B::BitArray; init=0) = bitcount(B.chunks; init) +_count(::typeof(identity), B::BitArray, ::Colon, init) = bitcount(B.chunks; init) function unsafe_bitfindnext(Bc::Vector{UInt64}, start::Int) chunk_start = _div64(start-1)+1 diff --git a/test/bitarray.jl b/test/bitarray.jl index ebc99e5fe9568..23cbeae1ffa5c 100644 --- a/test/bitarray.jl +++ b/test/bitarray.jl @@ -1221,6 +1221,7 @@ timesofar("datamove") end @test count(trues(2, 2), init=0x03) === 0x07 + @test count(trues(2, 2, 2), dims=2) == fill(2, 2, 1, 2) end timesofar("find")