Skip to content

Commit

Permalink
Avoid a couple of InexactErrors in the IdDict code. (#48116)
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Jan 5, 2023
1 parent 35d1840 commit 321c5f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/iddict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ end

empty(d::IdDict, ::Type{K}, ::Type{V}) where {K, V} = IdDict{K,V}()

function rehash!(d::IdDict, newsz = length(d.ht))
function rehash!(d::IdDict, newsz = length(d.ht)%UInt)
d.ht = ccall(:jl_idtable_rehash, Vector{Any}, (Any, Csize_t), d.ht, newsz)
d
end
Expand All @@ -89,7 +89,7 @@ function setindex!(d::IdDict{K,V}, @nospecialize(val), @nospecialize(key)) where
val = convert(V, val)
end
if d.ndel >= ((3*length(d.ht))>>2)
rehash!(d, max(length(d.ht)>>1, 32))
rehash!(d, max((length(d.ht)%UInt)>>1, 32))
d.ndel = 0
end
inserted = RefValue{Cint}(0)
Expand Down Expand Up @@ -143,7 +143,7 @@ end
_oidd_nextind(a, i) = reinterpret(Int, ccall(:jl_eqtable_nextind, Csize_t, (Any, Csize_t), a, i))

function iterate(d::IdDict{K,V}, idx=0) where {K, V}
idx = _oidd_nextind(d.ht, idx)
idx = _oidd_nextind(d.ht, idx%UInt)
idx == -1 && return nothing
return (Pair{K, V}(d.ht[idx + 1]::K, d.ht[idx + 2]::V), idx + 2)
end
Expand Down

2 comments on commit 321c5f5

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.