You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
May I ask why there is an additional multiplication by 1.2 here?
// shrinkIfNeeded shrinks the deque if it has too many unused space.
func (d *Deque[T]) shrinkIfNeeded() {
if int(float64(d.segUsed()*2)*1.2) < cap(d.segs) {
newCapacity := cap(d.segs) / 2
seg := make([]*Segment[T], newCapacity)
for i := 0; i < d.segUsed(); i++ {
seg[i] = d.segs[(d.begin+i)%cap(d.segs)]
}
u := d.segUsed()
d.begin = 0
d.end = u
d.segs = seg
}
}
The text was updated successfully, but these errors were encountered:
May I ask why there is an additional multiplication by 1.2 here?
The text was updated successfully, but these errors were encountered: