func (in *inflights) freeTo(to uint64) {
	if in.count == 0 || to < in.buffer[in.start] {
		// out of the left side of the window
		return
	}

	idx := in.start
	var i int
	for i = 0; i < in.count; i++ {
		if to < in.buffer[idx] { // found the first large inflight
			break
		}

		// increase index and maybe rotate
		size := in.size
		if idx++; idx >= size {
			idx -= size
		}
	}
	// free i inflights and set new start index
	in.count -= i
	in.start = idx
	if in.count == 0 {
		// inflights is empty, reset the start index so that we don't grow the
		// buffer unnecessarily.
		in.start = 0
	}
}
func (in *inflights) freeTo(to uint64) {
	if in.count == 0 || to < in.buffer[in.start] {
		
		return
	}

	idx := in.start
	var i int
	for i = 0; i < in.count; i++ {
		if to < in.buffer[idx] { 
			break
		}

		
		size := in.size
		if idx++; idx >= size {
			idx -= size
		}
	}
	
	in.count -= i
	in.start = idx
	if in.count == 0 {
		
		
		in.start = 0
	}
}
func ( in * inflights ) freeTo ( to uint64 ) { if in . count == 0 || to < in . buffer [ in . start ] { // out of the left side of the window return } idx := in . start var i int for i = 0 ; i < in . count ; i ++ { if to < in . buffer [ idx ] { // found the first large inflight break } // increase index and maybe rotate size := in . size if idx ++ ; idx >= size { idx -= size } } // free i inflights and set new start index in . count -= i in . start = idx if in . count == 0 { // inflights is empty, reset the start index so that we don't grow the // buffer unnecessarily. in . start = 0 } }
// freeTo frees the inflights smaller or equal to the given `to` flight.
freeTo frees the inflights smaller or equal to the given to flight .