// NextPowerOf2U64 returns the next power of 2 for a given 64bit number
762203
func NextPowerOf2U64(v uint64) uint64 {
	v--
	v |= v >> 1
	v |= v >> 2
	v |= v >> 4
	v |= v >> 8
	v |= v >> 16
	v |= v >> 32
	v++
	return v
}
787724
func (ri *runIterator16) next() uint16 {
	if !ri.hasNext() {
		panic("no Next available")
	}
	if ri.curIndex >= int64(len(ri.rc.iv)) {
		panic("runIterator.Next() going beyond what is available")
	}
	if ri.curIndex == -1 {
		// first time is special
		ri.curIndex = 0
	} else {
		ri.curPosInIndex++
		if int64(ri.rc.iv[ri.curIndex].start)+int64(ri.curPosInIndex) == int64(ri.rc.iv[ri.curIndex].last())+1 {
			ri.curPosInIndex = 0
			ri.curIndex++
		}
		ri.curSeq++
	}
	return ri.cur()
}
83786
func WriteUint64(w io.Writer, value uint64) error {
	return binary.Write(w, binary.BigEndian, value)
}
563276
func (i *Uint64) Next() uint64 {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment++
	return i.increment
}
15437
func int64MultiplyScale1000(a int64) (int64, bool) {
	if a == 0 || a == 1 {
		return a * 1000, true
	}
	if a == mostNegative {
		return 0, false
	}
	c := a * 1000
	return c, c/1000 == a
}
442270
func (vs *Set) MaybePower(id crypto.Address) *big.Int {
	if vs.powers[id] == nil {
		return nil
	}
	return new(big.Int).Set(vs.powers[id])
}
1230203
func (c *FleetClient) nextUnit(component string) (num int, err error) {
	units, err := c.Units(component)
	if err != nil {
		return
	}
	num, err = nextUnitNum(units)
	if err != nil {
		return
	}
	return
}
142002
func StrLenOfUint64Fast(x uint64) int {
	for i := 1; ; i++ {
		if x <= uintSizeTable[i] {
			return i
		}
	}
}
1020299
func (r *myRnd) NextByte() byte {
	r.seed1 = (r.seed1*3 + r.seed2) % myRndMaxVal
	r.seed2 = (r.seed1 + r.seed2 + 33) % myRndMaxVal

	return byte(uint64(r.seed1) * 31 / myRndMaxVal)
}
20708
func (p *GenParameters) NextInt64() int64 {
	v := p.Rng.Int63()
	if p.NextBool() {
		return -v
	}
	return v
}
874527
func (ung UniformGenerator) Int64n(n int64) int64 {
	if n <= 0 {
		panic(fmt.Sprintf("Illegal parameter n: %d", n))
	}
	ung.mu.Lock()
	defer ung.mu.Unlock()
	return ung.rd.Int63n(n)
}
656062
func (ung UniformGenerator) Int64() int64 {
	ung.mu.Lock()
	defer ung.mu.Unlock()
	return ung.rd.Int63()
}
556707
func maxDecimalPower(r float64) float64 {
	m := int(math.Floor(math.Log10(r)))
	return math.Pow10(m)
}
315840
func FloorToPowerOfTwo(n int) int {
	if n <= 2 {
		return n
	}
	n = fillBits(n)
	n >>= 1
	n++
	return n
}
489485
func Pow(num, power cty.Value) (cty.Value, error) {
	return PowFunc.Call([]cty.Value{num, power})
}
497848
func Uint64(cardinality int) uint64 {
	globalLk.Lock()
	defer globalLk.Unlock()
	return globalGen.Uint64(cardinality)
}
407246
func (ps *PassState) Next(nextState MachineState) MachineState {
	ps.next = nextState
	return ps
}