@@ -10,7 +10,7 @@ using .Base: copymutable, LinearIndices, length, (:),
10
10
AbstractVector, @inbounds , AbstractRange, @eval , @inline , Vector, @noinline ,
11
11
AbstractMatrix, AbstractUnitRange, isless, identity, eltype, > , < , <= , >= , | , + , - , * , ! ,
12
12
extrema, sub_with_overflow, add_with_overflow, oneunit, div, getindex, setindex!,
13
- length, resize!, fill, Missing, has_offset_axes
13
+ length, resize!, fill, Missing, require_one_based_indexing
14
14
15
15
using . Base: >>> , != =
16
16
@@ -222,7 +222,7 @@ function searchsorted(v::AbstractVector, x, ilo::Int, ihi::Int, o::Ordering)
222
222
end
223
223
224
224
function searchsortedlast (a:: AbstractRange{<:Real} , x:: Real , o:: DirectOrdering )
225
- has_offset_axes (a) && throw ( ArgumentError ( " range must be indexed starting with 1 " ) )
225
+ require_one_based_indexing (a )
226
226
if step (a) == 0
227
227
lt (o, x, first (a)) ? 0 : length (a)
228
228
else
@@ -232,7 +232,7 @@ function searchsortedlast(a::AbstractRange{<:Real}, x::Real, o::DirectOrdering)
232
232
end
233
233
234
234
function searchsortedfirst (a:: AbstractRange{<:Real} , x:: Real , o:: DirectOrdering )
235
- has_offset_axes (a) && throw ( ArgumentError ( " range must be indexed starting with 1 " ) )
235
+ require_one_based_indexing (a )
236
236
if step (a) == 0
237
237
lt (o, first (a), x) ? length (a) + 1 : 1
238
238
else
@@ -242,7 +242,7 @@ function searchsortedfirst(a::AbstractRange{<:Real}, x::Real, o::DirectOrdering)
242
242
end
243
243
244
244
function searchsortedlast (a:: AbstractRange{<:Integer} , x:: Real , o:: DirectOrdering )
245
- has_offset_axes (a) && throw ( ArgumentError ( " range must be indexed starting with 1 " ) )
245
+ require_one_based_indexing (a )
246
246
if step (a) == 0
247
247
lt (o, x, first (a)) ? 0 : length (a)
248
248
else
@@ -251,7 +251,7 @@ function searchsortedlast(a::AbstractRange{<:Integer}, x::Real, o::DirectOrderin
251
251
end
252
252
253
253
function searchsortedfirst (a:: AbstractRange{<:Integer} , x:: Real , o:: DirectOrdering )
254
- has_offset_axes (a) && throw ( ArgumentError ( " range must be indexed starting with 1 " ) )
254
+ require_one_based_indexing (a )
255
255
if step (a) == 0
256
256
lt (o, first (a), x) ? length (a)+ 1 : 1
257
257
else
@@ -260,7 +260,7 @@ function searchsortedfirst(a::AbstractRange{<:Integer}, x::Real, o::DirectOrderi
260
260
end
261
261
262
262
function searchsortedfirst (a:: AbstractRange{<:Integer} , x:: Unsigned , o:: DirectOrdering )
263
- has_offset_axes (a) && throw ( ArgumentError ( " range must be indexed starting with 1 " ) )
263
+ require_one_based_indexing (a )
264
264
if lt (o, first (a), x)
265
265
if step (a) == 0
266
266
length (a) + 1
@@ -273,7 +273,7 @@ function searchsortedfirst(a::AbstractRange{<:Integer}, x::Unsigned, o::DirectOr
273
273
end
274
274
275
275
function searchsortedlast (a:: AbstractRange{<:Integer} , x:: Unsigned , o:: DirectOrdering )
276
- has_offset_axes (a) && throw ( ArgumentError ( " range must be indexed starting with 1 " ) )
276
+ require_one_based_indexing (a )
277
277
if lt (o, x, first (a))
278
278
0
279
279
elseif step (a) == 0
0 commit comments