code: func (f *AckFrame) numEncodableAckRanges() int {
  	length := 1 + utils.VarIntLen(uint64(f.LargestAcked())) + utils.VarIntLen(encodeAckDelay(f.DelayTime))
  	length += 2 // assume that the number of ranges will consume 2 bytes
  	for i := 1; i < len(f.AckRanges); i++ {
  		gap, len := f.encodeAckRange(i)
  		rangeLen := utils.VarIntLen(gap) + utils.VarIntLen(len)
  		if length+rangeLen > protocol.MaxAckFrameSize {
  			// Writing range i would exceed the MaxAckFrameSize.
  			// So encode one range less than that.
  			return i - 1
  		}
  		length += rangeLen
  	}
  	return len(f.AckRanges)
  }
docs: // gets the number of ACK ranges that can be encoded
  // such that the resulting frame is smaller than the maximum ACK frame size