Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@inbounds @boundscheck does not work; should have tested it earlier. #2392

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/systems/connectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
h::UInt
end
function _hash_impl(sys, v, isouter)
hashcore = hash(nameof(sys)) ⊻ hash(getname(v))
hashcore = hash(nameof(sys)::Symbol) ⊻ hash(getname(v)::Symbol)

Check warning on line 153 in src/systems/connectors.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/connectors.jl#L153

Added line #L153 was not covered by tests
hashouter = isouter ? hash(true) : hash(false)
hashcore ⊻ hashouter
end
Expand All @@ -162,11 +162,12 @@
function Base.:(==)(l1::ConnectionElement, l2::ConnectionElement)
nameof(l1.sys) == nameof(l2.sys) && isequal(l1.v, l2.v) && l1.isouter == l2.isouter
end

const _debug_mode = Base.JLOptions().check_bounds == 1

function Base.hash(e::ConnectionElement, salt::UInt)
@inbounds begin
@boundscheck begin
@assert e.h === _hash_impl(e.sys, e.v, e.isouter)
end
if _debug_mode
@assert e.h === _hash_impl(e.sys, e.v, e.isouter)

Check warning on line 170 in src/systems/connectors.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/connectors.jl#L169-L170

Added lines #L169 - L170 were not covered by tests
end
e.h ⊻ salt
end
Expand Down
Loading