Skip to content

Commit 27a8799

Browse files
committed
Make empty!(::BitSet) work during bootstrap
1 parent d34fb93 commit 27a8799

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

base/idset.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,17 @@ function sizehint!(s::IdSet, newsz)
9292
nothing
9393
end
9494

95+
function _zero!(a::Memory{<:BitInteger})
96+
t = @_gc_preserve_begin a
97+
p = unsafe_convert(Ptr{Cvoid}, a)
98+
T = eltype(a)
99+
memset(p, 0x0, (sizeof(T) * length(a)) % UInt)
100+
@_gc_preserve_end t
101+
return a
102+
end
103+
95104
function empty!(s::IdSet)
96-
fill!(s.idxs, 0x00)
105+
_zero!(s.idxs)
97106
list = s.list
98107
for i = 1:s.max
99108
_unsetindex!(list, i)

0 commit comments

Comments
 (0)