From 66ea780fe36a5d821b02a18d92ff32aa19701cca Mon Sep 17 00:00:00 2001 From: Gabriel Kronberger Date: Sun, 25 Aug 2024 11:23:43 +0200 Subject: [PATCH] Revert change in UniqueQueue as it does not work with Julia v1.8 --- src/EGraphs/uniquequeue.jl | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/EGraphs/uniquequeue.jl b/src/EGraphs/uniquequeue.jl index 7c080156..512bb61a 100644 --- a/src/EGraphs/uniquequeue.jl +++ b/src/EGraphs/uniquequeue.jl @@ -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 @@ -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 -