Skip to content

Commit

Permalink
@inline binary heap top call (#292)
Browse files Browse the repository at this point in the history
* `@inline` binary heap `top` call

This will allow `@inbounds` to propagate into this call.

* Update binary_heap.jl
  • Loading branch information
ChrisRackauckas authored and oxinabox committed Nov 2, 2017
1 parent 40d6460 commit 4cd1448
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/heaps/binary_heap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ end
Returns the element at the top of the heap `h`.
"""
top(h::BinaryHeap) = h.valtree[1]
@inline top(h::BinaryHeap) = h.valtree[1]

pop!(h::BinaryHeap{T}) where {T} = _binary_heap_pop!(h.comparer, h.valtree)
2 changes: 1 addition & 1 deletion src/heaps/mutable_binary_heap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function push!(h::MutableBinaryHeap{T}, v::T) where T
i
end

top(h::MutableBinaryHeap) = h.nodes[1].value
@inline top(h::MutableBinaryHeap) = h.nodes[1].value

"""
top_with_handle(h::MutableBinaryHeap)
Expand Down

0 comments on commit 4cd1448

Please sign in to comment.