Skip to content

Commit

Permalink
simplify if test for overwrite case again.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgryski committed Jun 15, 2015
1 parent 361de55 commit 71ec324
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions movingmedian.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (m *MovingMedian) Push(v float64) {
if m.nitems == len(m.queue) {
heapIndex := itemPtr.idx
if heapIndex < minHeapLen && itemPtr == m.minHeap.itemHeap[heapIndex] {
if v >= m.minHeap.itemHeap[0].f || v >= m.maxHeap.itemHeap[0].f {
if v >= m.maxHeap.itemHeap[0].f {
itemPtr.f = v
heap.Fix(&m.minHeap, heapIndex)
return
Expand All @@ -95,7 +95,7 @@ func (m *MovingMedian) Push(v float64) {
heap.Fix(&m.maxHeap, 0)
return
} else {
if v <= m.maxHeap.itemHeap[0].f || v <= m.minHeap.itemHeap[0].f {
if v <= m.minHeap.itemHeap[0].f {
itemPtr.f = v
heap.Fix(&m.maxHeap, heapIndex)
return
Expand Down

0 comments on commit 71ec324

Please sign in to comment.