Skip to content

Commit

Permalink
Revert change in UniqueQueue as it does not work with Julia v1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
gkronber committed Aug 25, 2024
1 parent a3ebcb6 commit 66ea780
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/EGraphs/uniquequeue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ end
UniqueQueue{T}() where {T} = UniqueQueue{T}(Set{T}(), T[])

function Base.push!(uq::UniqueQueue{T}, x::T) where {T}
if !in!(x, uq.set)
if !(x in uq.set)
push!(uq.set, x)
push!(uq.vec, x)
end
end
Expand All @@ -30,15 +31,3 @@ function Base.pop!(uq::UniqueQueue{T}) where {T}
end

Base.isempty(uq::UniqueQueue) = isempty(uq.vec)

# Helper for push!()
# checks if x is contained in s and adds x if it is not, using a single hash call and lookup
# available from Julia 1.11
function in!(x::T, s::Set{T}) where {T}
idx, sh = Base.ht_keyindex2_shorthash!(s.dict, x)
idx > 0 && return true
Base._setindex!(s.dict, nothing, x, -idx, sh)

false
end

0 comments on commit 66ea780

Please sign in to comment.