From ca075469eb2f09575946e8d122200c6e4d3b0697 Mon Sep 17 00:00:00 2001 From: Simeon Schaub Date: Fri, 8 Jan 2021 19:34:09 +0100 Subject: [PATCH] fix count(::BitArray; dims) (#39149) Not sure why this worked before #37461, perhaps #9498? --- base/bitarray.jl | 2 +- test/bitarray.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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")