Skip to content

Commit

Permalink
faster indexing with UInt for Arrays (JuliaLang#29784)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored and fredrikekre committed Oct 25, 2018
1 parent 36e21d4 commit 2f27db9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/indices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ simply calls the generic `to_index(i)`. This must return either an `Int` or an
"""
to_index(A, i) = to_index(i)

# This is ok for Array because values larger than
# typemax(Int) will BoundsError anyway
to_index(A::Array, i::UInt) = reinterpret(Int, i)

"""
to_index(i)
Expand Down

0 comments on commit 2f27db9

Please sign in to comment.