// Length returns the number of bytes in the body.
498135
func (body *Body) Length() int64 {
	if body == nil {
		return 0
	}
	return int64(len(body.b))
}
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
}
1054071
func Length() (l int, err error) {
	if localStorage == nil || localStorage == js.Undefined {
		return 0, ErrLocalStorageNotSupported
	}
	defer func() {
		if r := recover(); r != nil {
			var ok bool
			err, ok = r.(error)
			if !ok {
				err = fmt.Errorf("could not use local storage: %v", r)
			}
			l = 0
		}
	}()

	length := localStorage.Get("length")
	return length.Int(), nil
}
597693
func Length(x uint64) int {
	// TODO: use math/bits when it's merged in 1.9

	// Loop: for loop
	// Log10: math.Log10
	// Asm: https://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
	// 	with "IntegerLogBase2(v)" in assembly implemented similar to GCC's
	// 	__builtin_clzll.
	// Cond: the switch below
	//
	// 	Seq: sequential numbers
	// 	Rand: random numbers
	//
	// BenchmarkIntLenLoopSeq-4     	200000000         7.87 ns/op
	// BenchmarkIntLenLog10Seq-4    	30000000        43.8 ns/op
	// BenchmarkIntLenAsmSeq-4      	200000000         7.38 ns/op
	// BenchmarkIntLenCondSeq-4     	500000000         3.67 ns/op
	//
	// BenchmarkIntLenLoopRand-4    	10000000000000000000        21.8 ns/op
	// BenchmarkIntLenLog10Rand-4   	30000000        44.5 ns/op
	// BenchmarkIntLenAsmRand-4     	200000000         8.62 ns/op
	// BenchmarkIntLenCondRand-4    	200000000         8.09 ns/op

	switch {
	case x < 10:
		return 1
	case x < 100:
		return 2
	case x < 1000:
		return 3
	case x < 10000:
		return 4
	case x < 100000:
		return 5
	case x < 1000000:
		return 6
	case x < 10000000:
		return 7
	case x < 100000000:
		return 8
	case x < 1000000000:
		return 9
	case x < 10000000000:
		return 10
	case x < 100000000000:
		return 11
	case x < 1000000000000:
		return 12
	case x < 10000000000000:
		return 13
	case x < 100000000000000:
		return 14
	case x < 1000000000000000:
		return 15
	case x < 10000000000000000:
		return 16
	case x < 100000000000000000:
		return 17
	case x < 1000000000000000000:
		return 18
	case x < 10000000000000000000:
		return 19
	default:
		panic("unreachable")
	}
}
106493
func (g *MultiPolygon) Length() float64 {
	return length3(g.flatCoords, 0, g.endss, g.stride)
}
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
}
238736
func (m *MultipartStreamer) Len() int64 {
	return m.contentLength + int64(m.bodyBuffer.Len()) + int64(m.closeBuffer.Len())
}
431628
func (sr *Stackers) Length() int {
	var l int
	sr.ro.Lock()
	{
		l = len(sr.stacks)
		sr.ro.Unlock()
	}
	return l
}
1369709
func Length(db XODB, v0 []byte, v1 string, v2 pgtypes.Lseg, v3 pgtypes.Path, v4 string, v5 uint8, v6 pgtypes.Tsvector, v7 []byte, v8 pgtypes.Name) (int, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.length($1, $2, $3, $4, $5, $6, $7, $8, $9)`

	// run query
	var ret int
	XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8)
	err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8).Scan(&ret)
	if err != nil {
		return 0, err
	}

	return ret, nil
}
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
}
1181373
func (f *ConnectionCloseFrame) Length(version protocol.VersionNumber) protocol.ByteCount {
	length := 1 + 2 + utils.VarIntLen(uint64(len(f.ReasonPhrase))) + protocol.ByteCount(len(f.ReasonPhrase))
	if !f.IsApplicationError {
		length++ // for the frame type
	}
	return length
}
993992
func (req *MCRequest) Size() int {
	return HDR_LEN + len(req.Extras) + len(req.Key) + len(req.Body)
}
615147
func Length(p0, p1, p2, p3 *vec2.T, t float64) float64 {
	sqrT := t * t
	t1 := sqrT * 0.5
	t2 := sqrT * t * 1.0 / 3.0
	t3 := sqrT*sqrT + 1.0/4.0

	f := 2*t3 - 3*t2 + t
	result := p0.Scaled(f)

	f = t3 - 2*t2 + t1
	tAf := p1.Scaled(f)
	result.Add(&tAf)

	f = t3 - t2
	tBf := p3.Scaled(f)
	result.Add(&tBf)

	f = -2*t3 + 3*t2
	pBf := p2.Scaled(f)
	result.Add(&pBf)

	return result.Length()
}
598975
func (f *Footer) Length() uint64 {
	jBuf, err := json.Marshal(f)
	if err != nil {
		return 0
	}

	footerLen := footerBegLen + len(jBuf) + footerEndLen
	return uint64(footerLen)
}
1344169
func (s *OIDSet) Length() int {
	if s == nil {
		return 0
	}
	return int(s.C_gss_OID_set.count)
}
385718
func (f *NewTokenFrame) Length(protocol.VersionNumber) protocol.ByteCount {
	return 1 + utils.VarIntLen(uint64(len(f.Token))) + protocol.ByteCount(len(f.Token))
}
1365314
func (r *Request) Size() int64 {
	return int64(r.context.Request.Header.ContentLength())
}