Line data Source code
1 : # from OrdinaryDiffEq, generic_dense.jl 2 4490 : @inline function _searchsortedlast(v::AbstractVector, x, lo::Integer, forward::Bool) 3 4490 : u = oftype(lo, 1) 4 4490 : lo = lo - u 5 4490 : hi = length(v) + u 6 4490 : @inbounds while lo < hi - u 7 28979 : m = (lo + hi) >>> 1 8 : # NOTE: first(v[m]) for well-defined and efficient comparison in :txdx 9 46243 : @inbounds if (forward && first(v[m]) > x) || (!forward && first(v[m]) < x) 10 13968 : hi = m 11 : else 12 43990 : lo = m 13 : end 14 28979 : end 15 4490 : return lo 16 : end