wanted: elide vector bounds checking for (min x (length v)) or generally index < x <= length
Bug #1830313 reported by
3b
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
sbcl can elide bounds checks when it knows (< index (length vector)), but not more complicated cases.
When iterating over part of a vector, it would be nice to also skip checks when the end is known to be in bounds.
for example:
(loop for i below (min x (length v)) ... (aref v i))
or
(assert (<= x (length v)))
(loop for i below x ... (aref v i))
doesn't have to be completely general as long as there is some reasonable idiom for specifying it should be true, assuming the compiler can verify it quickly even if it can't derive it.
To post a comment you must log in.
see also bug #1830314