// countSpentOutputs returns the number of utxos the passed block spends.
427076
func countSpentOutputs(block *btcutil.Block) int {
	// Exclude the coinbase transaction since it can't spend anything.
	var numSpent int
	for _, tx := range block.Transactions()[1:] {
		numSpent += len(tx.MsgTx().TxIn)
	}
	return numSpent
}
277577
func (rpc *EthRPC) EthGetTransactionCount(address, block string) (int, error) {
	var response string

	if err := rpc.call("eth_getTransactionCount", &response, address, block); err != nil {
		return 0, err
	}

	return ParseInt(response)
}
377441
func (s Linear) CountTicks(level int) int {
	return linearTicker{&s, false}.CountTicks(level)
}
1293075
func (bf BitField) CountSet() (ret uint32) {
	for _, b := range bf.data {
		if b != 0 {
			ret += uint32(bitCount[b])
		}
	}
	return ret
}
615007
func CountBitsUint32s(b []uint32) int {
	c := 0
	for _, x := range b {
		c += CountBitsUint32(x)
	}
	return c
}
1117438
func CountBitsUint64Alt(x uint64) int {
	return CountBitsUint32(uint32(x>>32)) + CountBitsUint32(uint32(x))
}
550228
func (pgb *ChainDB) CountTransactions(addr string, txnView dbtypes.AddrTxnViewType) (int, error) {
	merged, err := txnView.IsMerged()
	if err != nil {
		return 0, err
	}

	countFn := pgb.nonMergedTxnCount
	if merged {
		countFn = pgb.mergedTxnCount
	}

	count, err := countFn(addr, txnView)
	if err != nil {
		return 0, err
	}
	return count, nil
}
1079702
func DeviceCount() (uint, error) {
	if C.nvmlHandle == nil {
		return 0, errLibraryNotLoaded
	}
	var n C.uint
	r := C.nvmlDeviceGetCount(&n)
	return uint(n), errorString(r)
}
917819
func CountBytes(b []byte) (int, error) {
	var count int
	for len(b) >= 8 {
		v := binary.BigEndian.Uint64(b[:8])
		b = b[8:]

		sel := v >> 60
		if sel >= 16 {
			return 0, fmt.Errorf("invalid selector value: %v", sel)
		}
		count += selector[sel].n
	}

	if len(b) > 0 {
		return 0, fmt.Errorf("invalid slice len remaining: %v", len(b))
	}
	return count, nil
}
906626
func (ec *EthereumClient) GetPendingTransactionCount(ctx *Context) (count int, _ error) {
	rawCount, err := ec.client.PendingTransactionCount(ctx.context)
	return int(rawCount), err
}
1155451
func (b *bitmap) countRange(addr, n uintptr) uintptr {
	c := uintptr(0)
	for end := addr + n; addr < end; {
		block, baddr := b.block(addr)
		bend := uintptr(bmBlockRange - 1)
		if baddr+(end-addr) < bmBlockRange {
			bend = baddr + (end - addr)
		}
		c += uintptr(block.count(baddr, bend))
		// Move addr to next block.
		addr += bmBlockRange - baddr
	}
	return c
}
189440
func CountBitsUintPopCnt(x uint) int {
	if strconv.IntSize == 64 {
		return CountBitsUint64PopCnt(uint64(x))
	} else if strconv.IntSize == 32 {
		return CountBitsUint32PopCnt(uint32(x))
	}
	panic("strconv.IntSize must be 32 or 64")
}
55403
func (c *ScanCursor) TotalHits() int64 {
	if c.Results.Hits == nil {
		return 0
	}
	return c.Results.Hits.TotalHits
}
273454
func (b *bmBlock) count(start, end uintptr) (count int) {
	br := b[start/uintptrBits : end/uintptrBits+1]
	for i, w := range br {
		if i == 0 {
			w &= blockmask(start)
		}
		if i == len(br)-1 {
			w &^= blockmask(end)
		}
		count += onesCountPtr(w)
	}
	return count
}
187234
func CountBitsUint16s(b []uint16) int {
	c := 0
	for _, x := range b {
		c += CountBitsUint16(x)
	}
	return c
}
1275
func CountBitsUintReference(x uint) int {
	c := 0
	for x != 0 {
		x &= x - 1
		c++
	}
	return c
}
869095
func (p *deviceFolderDownloadState) GetBlockCounts() map[string]int {
	p.mut.RLock()
	res := make(map[string]int, len(p.files))
	for name, state := range p.files {
		res[name] = len(state.blockIndexes)
	}
	p.mut.RUnlock()
	return res
}