// scanInt64 converts a reply from redis into an int64 and scans the value into v.
972901
func scanInt64(reply interface{}, v *int64) error {
	if v == nil {
		return fmt.Errorf("jobs: In scanInt64: argument v was nil")
	}
	val, err := redis.Int64(reply, nil)
	if err != nil {
		return fmt.Errorf("jobs: In scanInt64: Could not convert %v of type %T to int64.", reply, reply)
	}
	(*v) = val
	return nil
}
632361
func (dec *Decoder) Int64(v *int64) error {
	err := dec.decodeInt64(v)
	if err != nil {
		return err
	}
	dec.called |= 1
	return nil
}
572003
func (r *reader) readVarInt64() int64 {
	ux := r.readVarUint64()
	x := int64(ux >> 1)
	if ux&1 != 0 {
		x = ^x
	}
	return x
}
939688
func (r *Store) GetInt64(key string) (int64, error) {
	v := r.GetEntry(key)
	if v == nil {
		return -1, fmt.Errorf(errFindParse, "int64", key)
	}
	return v.Int64Default(-1)
}
2380
func (c *Cell) Int64() (int64, error) {
	f, err := strconv.ParseInt(c.Value, 10, 64)
	if err != nil {
		return -1, err
	}
	return f, nil
}
739043
func (m Memory) Int64() int64 {
	i, err := strconv.ParseInt(string(m.Val), 10, 64)
	if err != nil && err.Error() != "strconv.ParseInt: parsing \"\"\"\": invalid syntax converting memory to int64" {
		m.log.Debugf("could not convert memory to int64 %s (%s, %s)",
			err, m.Key, string(m.Val))
	}
	return i
}
553073
func (t *TxStructure) HGetInt64(key []byte, field []byte) (int64, error) {
	value, err := t.HGet(key, field)
	if err != nil || value == nil {
		return 0, errors.Trace(err)
	}

	var n int64
	n, err = strconv.ParseInt(string(value), 10, 64)
	return n, errors.Trace(err)
}
1031311
func (ctx *Context) QueryInt64(key string, defaults ...int64) int64 {
	return (*Queries)(ctx.req).MustInt64(key, defaults...)
}
1135476
func (f *Queries) Int64(key string) (int64, error) {
	s, err := f.String(key)
	if err != nil {
		return 0, err
	}
	v, err := strconv.ParseInt(s, 10, 64)
	return v, err
}
579543
func (t *TxStructure) GetInt64(key []byte) (int64, error) {
	v, err := t.Get(key)
	if err != nil || v == nil {
		return 0, errors.Trace(err)
	}

	n, err := strconv.ParseInt(string(v), 10, 64)
	return n, errors.Trace(err)
}
1062929
func (r *MockResult) Int64(i int) int64 {
	if r.Contains(i) {
		return r.Result[i].(int64)
	} else {
		return 0
	}
}
647019
func (g *Group) Int64() *Statement {
	// notest
	s := Int64()
	g.items = append(g.items, s)
	return s
}
38771
func ReadVarInt64(r io.Reader) (int64, error) {
	var result int64
	var shift uint64
	size := uint64(32)
	buf := make([]byte, 1)
	for {
		if _, err := r.Read(buf); err != nil {
			return 0, err
		}
		v := int64(buf[0])
		result |= (v & 0x7F) << shift
		shift += 7
		if v&0x80 == 0 {
			if (shift < size) && (v&0x40 != 0) {
				result |= (^0 << shift)
			}
			return result, nil
		}
	}
}
1349110
func (context *BaseContext) GetInt64(
	key string, defaultValue ...int64) int64 {
	if value, ok := context.userData[key]; ok {
		if value, ok := value.(int64); ok {
			return value
		}
	}
	if len(defaultValue) > 0 {
		return defaultValue[0]
	}
	return 0
}
511751
func Int64(v int64) *int64 {
	p := new(int64)
	*p = v
	return p
}
859459
func FormatInt64(val int64, scale int) string {
	scl := int64(scale)
	var sfx []string
	if scale == 1000 {
		sfx = cKbScale
	} else if scale == 1024 {
		sfx = cKibScale
	} else {
		return strconv.FormatInt(val, 10)
	}
	idx := -1
	frac := scl / 2
	if val < 0 {
		frac = -frac
	}
	for idx < len(sfx)-1 && AbsInt64(val) > scl {
		val = (val + frac) / scl
		idx++
	}

	if idx >= 0 {
		return strconv.FormatInt(val, 10) + sfx[idx]
	}
	return strconv.FormatInt(val, 10)
}
29631
func (d *Datum) ToInt64(sc *stmtctx.StatementContext) (int64, error) {
	return d.toSignedInteger(sc, mysql.TypeLonglong)
}