Permalink
Browse files

elu-intervals: Papered over a bug that caused invalid indices --

need to look at this again
  • Loading branch information...
1 parent b3d8bf1 commit da51e67eed1e5b31399afb84d45daa40db5085df @notestaff committed Apr 3, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 elu-intervals.el
View
@@ -107,12 +107,15 @@ number to I, interval start to TBEG and interval end to TEND for each interval,
`(elu-with 'elu-intervals intervals (,from ,n ,shift ,width)
(when (and (> (elu-intervals-n intervals) 0)
(elu-intervals-intersect-p ,pmin ,pmax ,from (elu-intervals-end ,intervals (1- ,n))))
- (let* ((,first-interval-idx (if (and ,shift (> ,shift 0)) (floor (/ (- ,pmin ,from) ,shift)) 0))
+ (let* ((,first-interval-idx
+ (max 0 (if (and ,shift (> ,shift 0)) (floor (/ (- ,pmin ,from) ,shift)) 0)))
+ (dummy (assert (>= ,first-interval-idx 0)))
(,last-interval-start (+ ,from (* ,shift (1- ,n))))
(,last-interval-end (+ ,last-interval-start ,width))
- (,last-interval-idx (if (and ,shift (> ,shift 0))
- (- ,n (floor (/ (- ,last-interval-end ,pmax) ,shift)))
- 0))
+ (,last-interval-idx (min (1- ,n)
+ (if (and ,shift (> ,shift 0))
+ (- ,n (floor (/ (- ,last-interval-end ,pmax) ,shift)))
+ 0)))
(,tbeg (elu-intervals-beg ,intervals ,first-interval-idx))
(,tend (+ ,tbeg ,width))
(,i ,first-interval-idx))

0 comments on commit da51e67

Please sign in to comment.