// BEUvarint64 convert the uint64 type of varint(varying-length integer) to the binary data of big endian format byte order.
510492
func BEUvarint64(i uint64) []byte {
	dst := [8]byte{}
	binary.BigEndian.PutUint64(dst[:], i)
	return dst[:]
}
750059
func Int64U() (int64, error) {
	i, err := randDevInt64("/dev/urandom")
	return i, e.Forward(err)
}
1372107
func EncodeVarint(x uint64) []byte {
	var buf [maxVarintBytes]byte
	var n int
	for n = 0; x > 127; n++ {
		buf[n] = 0x80 | uint8(x&0x7F)
		x >>= 7
	}
	buf[n] = uint8(x)
	n++
	return buf[0:n]
}
1145323
func DecodeOrderPreservingVarUint64(bytes []byte) (uint64, int) {
	s, _ := proto.DecodeVarint(bytes)
	size := int(s)
	decodedBytes := make([]byte, 8)
	copy(decodedBytes[8-size:], bytes[1:size+1])
	numBytesConsumed := size + 1
	return binary.BigEndian.Uint64(decodedBytes), numBytesConsumed
}
111768
func (n *NamespacedKV) Int64(key string) (int64, bool) {
	valBs, err := n.db.Get(n.prefixedKey(key), nil)
	if err != nil {
		return 0, false
	}
	val := binary.BigEndian.Uint64(valBs)
	return int64(val), true
}
203671
func (ec *Envcfg) GetInt64(key string, base, bitSize int) int64 {
	i, _ := strconv.ParseInt(ec.GetKey(key), base, bitSize)
	return i
}
132459
func Int64(v []byte, err error) (int64, error) {
	if err != nil {
		return 0, err
	} else if v == nil || len(v) == 0 {
		return 0, nil
	} else if len(v) != 8 {
		return 0, errIntNumber
	}

	return int64(binary.LittleEndian.Uint64(v)), nil
}
160403
func (b *NullByteSizeInMb) ParseUint64Value(val *uint64) {
	if val == nil {
		b.IsSet = false
		b.Value = 0
		return
	}

	b.Value = *val
	b.IsSet = true
}
152849
func getuint64(val *querypb.BindVariable) (uv uint64, status int) {
	bv, err := sqltypes.BindVariableToValue(val)
	if err != nil {
		return 0, QROutOfRange
	}
	v, err := sqltypes.ToUint64(bv)
	if err != nil {
		return 0, QROutOfRange
	}
	return v, QROK
}
1344689
func (be *BinaryEncoder) WriteInt64(value int64) {
	binary.BigEndian.PutUint64(be.buffer[be.pos:], uint64(value))
	be.pos += 8
}
1314594
func (p *Buffer) EncodeVarint(x uint64) error {
	for x >= 1<<7 {
		p.buf = append(p.buf, uint8(x&0x7f|0x80))
		x >>= 7
	}
	p.buf = append(p.buf, uint8(x))
	return nil
}
517030
func encodeInt64(buf *bytes.Buffer, name string, val Int64) error {
	// type
	buf.WriteByte(_64BIT_INTEGER)

	// name
	if err := writeCstring(buf, name); err != nil {
		return err
	}

	// value
	binary.Write(buf, binary.LittleEndian, val)
	return nil
}
505353
func BytesToInt64(buf []byte, offset int) int64 {
	l := len(buf[offset:])
	if l > uint64sz {
		l = uint64sz
	}
	r := int64(binary.BigEndian.Uint64(buf[offset : offset+l]))
	return r
}
499250
func ToInt64(in interface{}) (int64, error) {
	if val, err := ToInt64E(in); err == nil {
		return val, nil
	}
	return 0, ErrBadType
}
268854
func (p *parserMixin) Int64() (target *int64) {
	target = new(int64)
	p.Int64Var(target)
	return
}
511751
func Int64(v int64) *int64 {
	p := new(int64)
	*p = v
	return p
}
1177593
func (c *JSONConfigContainer) DefaultInt64(key string, defaultval int64) int64 {
	if v, err := c.Int64(key); err == nil {
		return v
	}
	return defaultval
}