// Uint64s hamming distance of two uint64 buffers, of which the size of b0
// is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
343532
func Uint64s(b0, b1 []uint64) int {
	d := 0
	for i, x := range b0 {
		d += Uint64(x, b1[i])
	}
	return d
}
1249735
func randUint64(r *rand.Rand) uint64 {
	return uint64(r.Uint32())<<32 | uint64(r.Uint32())
}
876474
func (f *Forms) Uint64(key string) (uint64, error) {
	return strconv.ParseUint((*http.Request)(f).FormValue(key), 10, 64)
}
156245
func Uint64SliceToByteSlice(in []uint64) ([]byte, error) {
	buffer := bytes.NewBuffer(make([]byte, 0, len(in)*8))
	err := binary.Write(buffer, STORE_ENDIAN, in)
	if err != nil {
		return nil, err
	}

	return buffer.Bytes(), nil
}
1269018
func (g *Group) Uint64() *Statement {
	// notest
	s := Uint64()
	g.items = append(g.items, s)
	return s
}
694948
func ReverseBytes64(x uint64) uint64 {
	const m = 1<<64 - 1
	x = x>>8&(m3&m) | x&(m3&m)<<8
	x = x>>16&(m4&m) | x&(m4&m)<<16
	return x>>32 | x<<32
}
750846
func maxUint64(inputs ...uint64) uint64 {
	l := len(inputs)
	if l == 0 {
		return 0
	} else if l == 1 {
		return inputs[0]
	}

	max := inputs[0]
	for i := 1; i < l; i++ {
		cur := inputs[i]
		if cur > max {
			max = cur
		}
	}
	return max
}
996711
func (s *Session) Uint64(key string) uint64 {
	s.RLock()
	defer s.RUnlock()

	v, ok := s.data[key]
	if !ok {
		return 0
	}

	value, ok := v.(uint64)
	if !ok {
		return 0
	}
	return value
}
1074145
func UInt64s(input []uint64) []uint64 {
	u := make([]uint64, 0, len(input))
	m := make(map[uint64]bool)

	for _, val := range input {
		if _, ok := m[val]; !ok {
			m[val] = true
			u = append(u, val)
		}
	}

	return u
}
1177093
func MulUint64(a uint64, b uint64) (uint64, error) {
	if b > 0 && a > math.MaxUint64/b {
		return 0, errors.Trace(ErrArithOverflow)
	}
	return a * b, nil
}
85466
func Uint64(v interface{}) (uint64, bool) {

	switch reflect.TypeOf(v).Kind() {
	case reflect.Uint:
		return uint64(v.(uint)), true
	case reflect.Uint8:
		return uint64(v.(uint8)), true
	case reflect.Uint16:
		return uint64(v.(uint16)), true
	case reflect.Uint32:
		return uint64(v.(uint32)), true
	case reflect.Uint64:
		return v.(uint64), true
	}

	return 0, false
}
787735
func SubUint64(a uint64, b uint64) (uint64, error) {
	if a < b {
		return 0, errors.Trace(ErrArithOverflow)
	}
	return a - b, nil
}
991415
func bigUint64(v *big.Int) (uint64, bool) {
	return v.Uint64(), !v.IsUint64()
}
586264
func (x *Big) Uint64() (uint64, bool) {
	if debug {
		x.validate()
	}

	if !x.IsFinite() || x.Signbit() {
		return 0, false
	}

	// x might be too large to fit into an uint64 *now*, but rescaling x might
	// shrink it enough. See issue #20.
	if !x.isCompact() {
		xb := x.Int(nil)
		return xb.Uint64(), xb.IsUint64()
	}

	b := x.compact
	if x.exp == 0 {
		return b, true
	}
	return scalex(b, x.exp)
}
777229
func Uint64Tobytes(d uint64) []byte {
	data := make([]byte, 8)
	offset := 7
	for i := 7; i >= 0; i-- {
		data[offset-i] = byte((d >> uint(i*8)) & 0xff)
	}
	return data
}
145276
func MulUint64(a uint64, b uint64) (uint64, error) {
	if b > 0 && a > math.MaxUint64/b {
		return 0, ErrOverflow.GenWithStackByArgs("BIGINT UNSIGNED", fmt.Sprintf("(%d, %d)", a, b))
	}
	return a * b, nil
}
497848
func Uint64(cardinality int) uint64 {
	globalLk.Lock()
	defer globalLk.Unlock()
	return globalGen.Uint64(cardinality)
}