// Capacity returns the value of the highest possible *seen* value
// in this sparse bitarray.
556924
func (sba *sparseBitArray) Capacity() uint64 {
	if len(sba.indices) == 0 {
		return 0
	}

	return (sba.indices[len(sba.indices)-1] + 1) * s
}
17522
func (r *Ring) Capacity() int {
	r.Lock()
	defer r.Unlock()

	return r.capacity()
}
967853
func (r *Cache) SetCapacity(capacity int) {
	if r.cacher != nil {
		r.cacher.SetCapacity(capacity)
	}
}
862173
func (st *Stack) ensureCapacity(newCapacity uint64) error {
	// Maximum length of a slice that allocates memory is the same as the native int max size
	// We could rethink this limit, but we don't want different validators to disagree on
	// transaction validity so we pick the lowest common denominator
	if newCapacity > math.MaxInt32 {
		// If we ever did want more than an int32 of space then we would need to
		// maintain multiple pages of memory
		return fmt.Errorf("cannot address memory beyond a maximum index "+
			"with int32 width (%v bytes)", math.MaxInt32)
	}
	newCapacityInt := int(newCapacity)
	// We're already big enough so return
	if newCapacityInt <= len(st.slice) {
		return nil
	}
	if st.maxCapacity > 0 && newCapacity > st.maxCapacity {
		return fmt.Errorf("cannot grow memory because it would exceed the "+
			"current maximum limit of %v bytes", st.maxCapacity)
	}
	// Ensure the backing array of slice is big enough
	// Grow the memory one word at time using the pre-allocated zeroWords to avoid
	// unnecessary allocations. Use append to make use of any spare capacity in
	// the slice's backing array.
	for newCapacityInt > cap(st.slice) {
		// We'll trust Go exponentially grow our arrays (at first).
		st.slice = append(st.slice, Zero256)
	}
	// Now we've ensured the backing array of the slice is big enough we can
	// just re-slice (even if len(mem.slice) < newCapacity)
	st.slice = st.slice[:newCapacity]
	return nil
}
359752
func (w *huffmanBitWriter) storedSize(in []byte) (int, bool) {
	if in == nil {
		return 0, false
	}
	if len(in) <= maxStoreBlockSize {
		return (len(in) + 5) * 8, true
	}
	return 0, false
}
766475
func ChannelCapacity(capacity btcutil.Amount) OptionalMsgField {
	return func(f *optionalMsgFields) {
		f.capacity = &capacity
	}
}
1311710
func (b *Blob) GetSize() int {
	if b == nil || b.Size == nil {
		return 0
	}
	return *b.Size
}
135698
func Dist(hash, i, capacity int64) int64 {
	mask := capacity - 1
	dist := (i + capacity - (hash & mask)) & mask
	return dist
}
627043
func (s *BulkService) estimateSizeInBytes(r BulkableRequest) int64 {
	lines, _ := r.Source()
	size := 0
	for _, line := range lines {
		// +1 for the \n
		size += len(line) + 1
	}
	return int64(size)
}
987634
func (v *priorityClientPool) totalCapacity() uint64 {
	v.lock.Lock()
	defer v.lock.Unlock()

	return v.totalCapAnnounced
}
145066
func (s *ModifyCurrentDBClusterCapacityInput) SetCapacity(v int64) *ModifyCurrentDBClusterCapacityInput {
	s.Capacity = &v
	return s
}
1279740
func (b *builderBuffer) growCapacity(n uint) {
	_b := *b
	curLen := uint(len(_b))
	curCap := uint(cap(_b))
	newCap := curLen + n
	if newCap <= curCap {
		// No need to do anything
		return
	}
	// Increase the capacity
	extra := newCap // Grow a bit more to avoid copying all the time
	if extra < minGrowDelta {
		extra = minGrowDelta
	} else if extra > maxGrowDelta {
		extra = maxGrowDelta
	}
	newBuffer := make(builderBuffer, curLen, newCap+extra)
	copy(newBuffer, _b)
	*b = newBuffer
}
1336249
func CapacityBreakDown(capacityBytes int64) string {
	n := int64(math.Ceil(float64(capacityBytes) / float64(500*esUtil.GiB)))
	return fmt.Sprintf("%dG", n*500)
}
237271
func (c *CacheableFilter) Size() (uint64, error) {
	f, err := c.Filter.NBytes()
	if err != nil {
		return 0, err
	}
	return uint64(len(f)), nil
}
597158
func (a *allocator) reserved(n int) bool {
	return a.pool.Bit(n-a.low) == allocated
}
1168897
func (a *MinMaxAllocator) Allocate(i int) (bool, error) {
	a.lock.Lock()
	defer a.lock.Unlock()

	if !a.inRange(i) {
		return false, ErrOutOfRange
	}

	if a.has(i) {
		return false, ErrConflict
	}

	a.used[i] = true
	a.free--

	return true, nil
}
22170
func Maximum() (int, error) {
	var limit syscall.Rlimit
	if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
		return 0, err
	}
	return int(limit.Max), nil
}