File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,16 @@ function Base.searchsorted(a::Range, I::Interval)
36
36
searchsortedfirst (a, I. lo): searchsortedlast (a, I. hi)
37
37
end
38
38
39
+ if VERSION > v " 0.5.0-dev+4557"
40
+ # When running with "--check-bounds=yes" (like on Travis), the bounds-check isn't elided
41
+ @inline function Base. unsafe_getindex {T} (r:: FloatRange{T} , i:: Integer )
42
+ convert (T, (r. start + (i- 1 )* r. step)/ r. divisor)
43
+ end
44
+ @inline function Base. unsafe_getindex (r:: FloatRange , s:: OrdinalRange )
45
+ FloatRange (r. start + (first (s)- 1 )* r. step, step (s)* r. step, length (s), r. divisor)
46
+ end
47
+ end
48
+
39
49
function unsafe_searchsortedlast {T<:Number} (a:: Range{T} , x:: Number )
40
50
step (a) == 0 && throw (ArgumentError (" ranges with a zero step are unsupported" ))
41
51
n = round (Integer,(x- first (a))/ step (a))+ 1
You can’t perform that action at this time.
0 commit comments