// totalBytes iterates through all image layers and sums the total of
// total bytes. The caller is responsible for acquiring a read lock on the
// imageProgress struct
169742
func (p *imageProgress) totalBytes() int64 {
	var b int64
	for _, l := range p.layers {
		b += l.totalBytes
	}
	return b
}
59602
func (t *Template) ParseBytes(b []byte) error {
	return t.Parse(bytes.NewReader(b))
}
997551
func WriteBytes(w io.Writer, data []byte, offset int, count int) error {

	_, err := w.Write(data[offset : offset+count])
	if err != nil {
		return err
	}
	return nil
}
766353
func (s *StdoutClient) Total(stat string, value int64) error {
	return s.send(stat, "%d|t", value)
}
484213
func (bi *BigInt) SetBytes(buf []byte) {
	bi.bigint.SetBytes(common.CopyBytes(buf))
}
100166
func (rd *bitReader) readBytes(dst []byte) (int, error) {
	rd.bits = 0
	total := 0

	for len(dst) > 0 {
		if rd.head == rd.limit {
			if err := rd.refill(); err != nil {
				return total, err
			}
		}

		n := copy(dst, rd.buffer[rd.head:rd.limit])
		dst = dst[n:]
		rd.head += n
		total += n
	}

	return total, nil
}
861948
func (s *Storage) GetTotalCount() int64 {
	var count int64
	s.getBuntDB(storage.TotalCountKey, &count)

	return count
}
1074518
func IntBytes(n uint32, base uint) []byte {
	mask := uint32(1<<base - 1)
	bytes := make([]byte, BytesPerInt)

	for i, _ := range bytes {
		bytes[len(bytes)-i-1] = byte(n & mask)
		n >>= base
	}

	return bytes
}
1178251
func (s *Storage) GetTotalCount() int64 {
	var count int64
	s.getBoltDB(storage.TotalCountKey, &count)

	return count
}
1293055
func (t *fileTracker) AddBytes(bytes uint64) {
	atomic.AddUint64(&t.diskBytes, bytes)

	labels := t.Labels()
	t.metrics.DiskSize.With(labels).Add(float64(bytes))
}
1154787
func Sum(data, key []byte) [Size]byte {
	if len(key) != Size {
		panic(errKeySize)
	}
	var state [16]uint64
	initialize(&state, key)
	if n := len(data) & (^(Size - 1)); n > 0 {
		update(&state, data[:n])
		data = data[n:]
	}
	if len(data) > 0 {
		var block [Size]byte
		offset := copy(block[:], data)
		hashBuffer(&state, &block, offset)
	}
	var hash [Size]byte
	finalize(hash[:], &state)
	return hash
}
526742
func (p *imageProgress) currentBytes() int64 {
	var b int64
	for _, l := range p.layers {
		b += l.currentBytes
	}
	return b
}
904288
func countAnyByte(s string, t string) int {
	n := 0
	for i := 0; i < len(s); i++ {
		if byteIndex(t, s[i]) >= 0 {
			n++
		}
	}
	return n
}
709126
func (s *SeriesIDSet) Bytes() int {
	var b int
	s.RLock()
	b += 24 // mu RWMutex is 24 bytes
	b += int(unsafe.Sizeof(s.bitmap)) + int(s.bitmap.GetSizeInBytes())
	s.RUnlock()
	return b
}
673611
func CopyBytes(b []byte) (copiedBytes []byte) {
	if b == nil {
		return nil
	}
	copiedBytes = make([]byte, len(b))
	copy(copiedBytes, b)

	return
}
745685
func (pc *ProbabilisticCounter) Bytes() ([]byte, error) {
	bytes, err := pc.bitset.MarshalBinary()
	if err != nil {
		return nil, errors.Wrap(err, "Unable to serialize ProbabilisticCounter into binary data")
	}
	return bytes, nil
}
1089123
func ReadBytes(buf io.ByteReader) (ret []byte, n int, err error) {
	tmpBuf := bytes.Buffer{}
	acc := byte(0)
	for i := 0; i < ReadByteLimit; i++ {
		o := byte(0)
		if o, err = buf.ReadByte(); err != nil {
			return
		}
		n++

		b := o & 0xfe // user data
		m := uint(i % 8)

		if m == 0 {
			acc = b
		} else {
			// ignore err since bytes.Buffer.WriteByte can never return one.
			_ = tmpBuf.WriteByte(acc | (b >> (8 - m)))
			acc = (b << m)
		}

		if o&1 == 0 { // stop bit is 0
			ret = tmpBuf.Bytes()
			return
		}
	}
	err = ErrByteLimitExceeded
	return
}