Skip to content
Closed
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
12 changes: 6 additions & 6 deletions src/kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@ function _kernel_last_linear_scan(
return lo - 1 # empty vector
end
i = clamp(hint, lo, hi)
@inbounds if Base.Order.lt(order, x, v[i])
if @inbounds Base.Order.lt(order, x, v[i])
# v[i] > x → retreat
while i > lo
i -= 1
!Base.Order.lt(order, x, v[i]) && return i
@inbounds !Base.Order.lt(order, x, v[i]) && return i
end
return lo - 1 # x precedes all of v
else
# v[i] ≤ x → try to advance
while i < hi
Base.Order.lt(order, x, v[i + 1]) && return i
@inbounds Base.Order.lt(order, x, v[i + 1]) && return i
i += 1
end
return hi
Expand All @@ -175,17 +175,17 @@ function _kernel_first_linear_scan(
return lo
end
i = clamp(hint, lo, hi)
@inbounds if Base.Order.lt(order, v[i], x)
if @inbounds Base.Order.lt(order, v[i], x)
# v[i] < x → advance
while i < hi
i += 1
!Base.Order.lt(order, v[i], x) && return i
@inbounds !Base.Order.lt(order, v[i], x) && return i
end
return hi + 1 # x exceeds all of v
else
# v[i] ≥ x → try to retreat
while i > lo
!Base.Order.lt(order, v[i - 1], x) && (i -= 1; continue)
@inbounds !Base.Order.lt(order, v[i - 1], x) && (i -= 1; continue)
return i
end
return lo
Expand Down
Loading