Additional simplifications.

This commit is contained in:
Matt T. Proud 2013-03-18 12:26:45 -07:00
parent fd47ac570f
commit 73b463e814

View file

@ -404,15 +404,12 @@ func optimizeForward(pending ops) (out ops) {
from = next.from from = next.from
) )
for { for !from.After(next.through) {
from = from.Add(t.interval) from = from.Add(t.interval)
if from.After(next.through) {
after.from = from
break
}
} }
after.from = from
pending = append(ops{&before, &after}, pending...) pending = append(ops{&before, &after}, pending...)
sort.Sort(startsAtSort{pending}) sort.Sort(startsAtSort{pending})
@ -451,17 +448,15 @@ func optimizeForward(pending ops) (out ops) {
if next.GreedierThan(t) { if next.GreedierThan(t) {
var ( var (
t = next.from nextStart = next.from
) )
for {
t = t.Add(next.interval)
if t.After(next.through) { for !nextStart.After(next.through) {
next.from = t nextStart = nextStart.Add(next.interval)
tail = append(ops{next}, pending...)
}
} }
next.from = nextStart
tail = append(ops{next}, pending...)
} }
default: default:
panic("unknown operation type") panic("unknown operation type")