Skip to content

Commit

Permalink
Simplied PushFront
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrpetrin committed Nov 22, 2018
1 parent 043fd89 commit b872075
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions deque.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (d *Deque) PushFront(v interface{}) {
copy(n[d.hp:], d.head.v)
d.head.v = n
d.hp--
} else if d.tp > d.lastTailPosition {
} else {
n := &node{v: make([]interface{}, maxInternalSliceSize)}
n.n = d.head
n.p = d.tail
Expand All @@ -185,8 +185,6 @@ func (d *Deque) PushFront(v interface{}) {
d.hp = internalSliceLastPosition
d.tp = len(d.tail.v) - 1
d.lastTailPosition = internalSliceLastPosition
} else {
copy(d.head.v[d.hp+1:], d.head.v[d.hp:])
}
} else {
n := &node{v: make([]interface{}, maxInternalSliceSize)}
Expand Down

0 comments on commit b872075

Please sign in to comment.