Skip to content

Commit ca07546

Browse files
authored
fix count(::BitArray; dims) (#39149)
Not sure why this worked before #37461, perhaps #9498?
1 parent 438f9cb commit ca07546

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

base/bitarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ function bitcount(Bc::Vector{UInt64}; init::T=0) where {T}
13941394
return n
13951395
end
13961396

1397-
count(B::BitArray; init=0) = bitcount(B.chunks; init)
1397+
_count(::typeof(identity), B::BitArray, ::Colon, init) = bitcount(B.chunks; init)
13981398

13991399
function unsafe_bitfindnext(Bc::Vector{UInt64}, start::Int)
14001400
chunk_start = _div64(start-1)+1

test/bitarray.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ timesofar("datamove")
12211221
end
12221222

12231223
@test count(trues(2, 2), init=0x03) === 0x07
1224+
@test count(trues(2, 2, 2), dims=2) == fill(2, 2, 1, 2)
12241225
end
12251226

12261227
timesofar("find")

0 commit comments

Comments
 (0)