// Length returns the number of bytes in the Buffer.
180907
func (b *Buffer) Length() int {
	if b == nil || b.C_gss_buffer_t == nil || b.C_gss_buffer_t.length == 0 {
		return 0
	}
	return int(b.C_gss_buffer_t.length)
}
1122925
func (s *Bitset) Length(l uint) uint {
	if l == 0 {
		return s.length
	}

	new := unitCount(l)
	if new > uint(cap(s.set)) || new <= s.UnitCount()>>1 {
		newSet := newUnits(new)
		copy(newSet, s.set)
		s.set = newSet
	} else {
		s.set = s.set[:new]
	}
	s.length = l

	return l
}
563826
func (aa *AtomicArray) Length() int {
	aa.mutex.RLock()
	res := aa.length
	aa.mutex.RUnlock()

	return res
}
1095217
func (f *StreamFrame) Length(version protocol.VersionNumber) protocol.ByteCount {
	length := 1 + utils.VarIntLen(uint64(f.StreamID))
	if f.Offset != 0 {
		length += utils.VarIntLen(uint64(f.Offset))
	}
	if f.DataLenPresent {
		length += utils.VarIntLen(uint64(f.DataLen()))
	}
	return length + f.DataLen()
}
346242
func (buf *Buffer) Bytes() []byte {
	if buf.buf == nil {
		return nil
	}

	p := make([]byte, buf.Len())
	buf.Read(p)
	buf.Close()
	return p
}
886270
func (f *AckFrame) Length(version protocol.VersionNumber) protocol.ByteCount {
	largestAcked := f.AckRanges[0].Largest
	numRanges := f.numEncodableAckRanges()

	length := 1 + utils.VarIntLen(uint64(largestAcked)) + utils.VarIntLen(encodeAckDelay(f.DelayTime))

	length += utils.VarIntLen(uint64(numRanges - 1))
	lowestInFirstRange := f.AckRanges[0].Smallest
	length += utils.VarIntLen(uint64(largestAcked - lowestInFirstRange))

	for i := 1; i < numRanges; i++ {
		gap, len := f.encodeAckRange(i)
		length += utils.VarIntLen(gap)
		length += utils.VarIntLen(len)
	}
	return length
}
259533
func (lru *LRUCache) Length() int64 {
	lru.mu.Lock()
	defer lru.mu.Unlock()
	return int64(lru.list.Len())
}
845385
func length(v interface{}, param string) error {
	st := reflect.ValueOf(v)
	valid := true
	if st.Kind() == reflect.Ptr {
		if st.IsNil() {
			return nil
		}
		st = st.Elem()
	}
	switch st.Kind() {
	case reflect.String:
		p, err := asInt(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = int64(len(st.String())) == p
	case reflect.Slice, reflect.Map, reflect.Array:
		p, err := asInt(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = int64(st.Len()) == p
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		p, err := asInt(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = st.Int() == p
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
		p, err := asUint(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = st.Uint() == p
	case reflect.Float32, reflect.Float64:
		p, err := asFloat(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = st.Float() == p
	default:
		return ErrUnsupported
	}
	if !valid {
		return ErrLen
	}
	return nil
}
308047
func (a PortRange) Length() int {
	if err := a.Validate(); err != nil {
		// Invalid range (from > to or something equally bad)
		return 0
	}
	return (a.ToPort - a.FromPort) + 1
}
243494
func (v *EntryBuffer) GetLength() uint {
	panic_if_version_older_auto(2, 18, 0)
	return uint(C._gtk_entry_buffer_get_length(v.GEntryBuffer))
}
300251
func Size(size string) (uint64, error) {
	var base uint64 = 1

	s := bytes.TrimSpace([]byte(size))
	switch s[len(s)-1] {
	case 'K', 'k':
		base *= KB
	case 'M', 'm':
		base *= MB
	case 'G', 'g':
		base *= GB
	case 'T', 't':
		base *= TB
	case 'P', 'p':
		base *= PB
	}

	if base > 1 {
		s = s[:len(s)-1]
	}

	bs, err := strconv.Atoi(string(s))
	if err != nil {
		return 0, err
	}

	if bs < 0 {
		bs = 0
	}

	return uint64(bs) * base, nil
}
964525
func Length(collection cty.Value) (cty.Value, error) {
	return LengthFunc.Call([]cty.Value{collection})
}
1161001
func ByteLength(str string, params ...string) bool {
	if len(params) == 2 {
		min, _ := ToInt(params[0])
		max, _ := ToInt(params[1])
		return len(str) >= int(min) && len(str) <= int(max)
	}

	return false
}
549699
func (ac *AddressCache) Length() (numAddrs, numTxns, numUTXOs int) {
	ac.mtx.RLock()
	defer ac.mtx.RUnlock()
	return ac.length()
}
238981
func (f *StreamsBlockedFrame) Length(_ protocol.VersionNumber) protocol.ByteCount {
	return 1 + utils.VarIntLen(f.StreamLimit)
}
1225270
func (f *Frame) length() int {
	// If payload is less than the required minimum length, we zero-pad up to
	// the required minimum length
	pl := len(f.Payload)
	if pl < minPayload {
		pl = minPayload
	}

	// Add additional length if VLAN tags are needed.
	var vlanLen int
	switch {
	case f.ServiceVLAN != nil && f.VLAN != nil:
		vlanLen = 8
	case f.VLAN != nil:
		vlanLen = 4
	}

	// 6 bytes: destination hardware address
	// 6 bytes: source hardware address
	// N bytes: VLAN tags (if present)
	// 2 bytes: EtherType
	// N bytes: payload length (may be padded)
	return 6 + 6 + vlanLen + 2 + pl
}
1296128
func (f *StopSendingFrame) Length(_ protocol.VersionNumber) protocol.ByteCount {
	return 1 + utils.VarIntLen(uint64(f.StreamID)) + 2
}