Skip to content

Commit 4cd1448

Browse files
ChrisRackauckasoxinabox
authored andcommitted
@inline binary heap top call (#292)
* `@inline` binary heap `top` call This will allow `@inbounds` to propagate into this call. * Update binary_heap.jl
1 parent 40d6460 commit 4cd1448

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/heaps/binary_heap.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,6 @@ end
147147
148148
Returns the element at the top of the heap `h`.
149149
"""
150-
top(h::BinaryHeap) = h.valtree[1]
150+
@inline top(h::BinaryHeap) = h.valtree[1]
151151

152152
pop!(h::BinaryHeap{T}) where {T} = _binary_heap_pop!(h.comparer, h.valtree)

src/heaps/mutable_binary_heap.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function push!(h::MutableBinaryHeap{T}, v::T) where T
208208
i
209209
end
210210

211-
top(h::MutableBinaryHeap) = h.nodes[1].value
211+
@inline top(h::MutableBinaryHeap) = h.nodes[1].value
212212

213213
"""
214214
top_with_handle(h::MutableBinaryHeap)

0 commit comments

Comments
 (0)