// WriteInt64 write int64 value to buf using big order
// return write bytes count, error
342135
func (b *ByteBuf) WriteInt64(v int64) (n int, err error) {
	b.Expansion(8)
	Int64ToBytesTo(v, b.buf[b.writerIndex:b.writerIndex+8])
	b.writerIndex += 8
	return 8, nil
}
477448
func (w *ByteWriter) MustWriteInt64(val int64, offset int) int {
	return w.MustWriteVal(val, offset)
}
1056367
func (w *ByteWriter) WriteUint64(val uint64, offset int) (int, error) {
	return w.WriteVal(val, offset)
}
87581
func (enc *Encoder) WriteInt8(val int8) error {
	return enc.WriteInt(int(val))
}
200706
func (w *Writer) WriteInt32(sample int32) error {
	err := binary.Write(w.sampleBuf, binary.LittleEndian, sample)
	if err != nil {
		return err
	}

	w.bytesWritten += 4

	return err
}
1116083
func Int64() int64 {
	var bs [8]byte
	_, err := io.ReadFull(cryptoRand.Reader, bs[:])
	if err != nil {
		panic("randomness failure: " + err.Error())
	}
	return int64(binary.BigEndian.Uint64(bs[:]))
}
831694
func (cmd *baseCommand) WriteInt64(num int64) (int, error) {
	return cmd.WriteUint64(uint64(num))
}
543915
func PackInt64(cmd BufferEx, val int64) (int, error) {
	return packAInt64(cmd, val)
}
1344689
func (be *BinaryEncoder) WriteInt64(value int64) {
	binary.BigEndian.PutUint64(be.buffer[be.pos:], uint64(value))
	be.pos += 8
}
103831
func toInt64(v reflect.Value) int64 {
	i, _ := tryToInt64(v)
	return i
}
105863
func (out *DataOutputImpl) WriteLong(i int64) error {
	err := out.WriteInt(int32(i >> 32))
	if err == nil {
		err = out.WriteInt(int32(i))
	}
	return err
}
455472
func (ed *eventData) writeInt16(value int16) {
	binary.Write(&ed.buffer, binary.LittleEndian, value)
}
1123665
func (ed *eventData) writeInt8(value int8) {
	ed.buffer.WriteByte(uint8(value))
}
463423
func (b *ByteBuf) WriteUInt64(v uint64) (n int, err error) {
	b.Expansion(8)
	Uint64ToBytesTo(v, b.buf[b.writerIndex:b.writerIndex+8])
	b.writerIndex += 8
	return 8, nil
}
1175620
func (c Context) Int64(key string, i int64) Context {
	c.l.context = enc.AppendInt64(enc.AppendKey(c.l.context, key), i)
	return c
}
174512
func (v *Value) Int64() (int64, error) {
	n, err := v.Number()

	if err != nil {
		return 0, err
	}

	return n.Int64()
}
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
}