// IntWithTie returns true/false if a is strictly less/greater than b, or
// returns result of tie. tie is called only when necessary.
351659
func IntWithTie(a, b int, tie func() bool) bool {
	if a < b {
		return true
	}
	if a > b {
		return false
	}
	return tie()
}
1047182
func DivUintWithInt(a uint64, b int64) (uint64, error) {
	if b < 0 {
		if a != 0 && uint64(-b) <= a {
			return 0, ErrOverflow.GenWithStackByArgs("BIGINT UNSIGNED", fmt.Sprintf("(%d, %d)", a, b))
		}

		return 0, nil
	}

	return a / uint64(b), nil
}
219230
func (c Context) Int32(key string, i int32) Context {
	c.l.context = enc.AppendInt32(enc.AppendKey(c.l.context, key), i)
	return c
}
37547
func (r *MockResult) Int(i int) int {
	if r.Contains(i) {
		return r.Result[i].(int)
	} else {
		return 0
	}
}
90393
func IntToTrits(value int64) Trits {
	if value == 0 {
		return Trits{0}
	}

	negative := value < 0
	size := MinTrits(value)
	valueAbs := MustAbsInt64(value)

	t := make(Trits, size)

	for i := 0; i < int(size); i++ {
		if valueAbs == 0 {
			break
		}
		trit := int8((valueAbs+1)%(TrinaryRadix) - 1)
		if negative {
			trit = -trit
		}
		t[i] = trit
		valueAbs++
		valueAbs /= TrinaryRadix
	}

	return t
}
1287809
func IsPointWithinLineBounds(p, lineEndpoint1, lineEndpoint2 geom.Coord) bool {
	minx := math.Min(lineEndpoint1[0], lineEndpoint2[0])
	maxx := math.Max(lineEndpoint1[0], lineEndpoint2[0])
	miny := math.Min(lineEndpoint1[1], lineEndpoint2[1])
	maxy := math.Max(lineEndpoint1[1], lineEndpoint2[1])
	return minx <= p[0] && maxx >= p[0] && miny <= p[1] && maxy >= p[1]
}
294915
func intsize(i uint64) (size int) {
	for size = 1; ; size++ {
		if i >>= 8; i == 0 {
			return size
		}
	}
}
1185397
func DivUintWithInt(a uint64, b int64) (uint64, error) {
	if b < 0 {
		if a != 0 && uint64(-b) <= a {
			return 0, errors.Trace(ErrArithOverflow)
		}

		return 0, nil
	}

	return a / uint64(b), nil
}
59174
func intLength(value int64) uint {
	if value >= -0x80 && value <= 0x7f {
		// shortcut for the common case
		return 1
	}
	var x uint64
	if value >= 0 {
		x = uint64(value)
	} else {
		x = uint64(-(value + 1))
	}
	xSize := uint(0)
	for {
		xSize++
		x >>= 8
		if x < 0x80 {
			return xSize + 1
		}
	}
}
883114
func (expr *Expr) IncludeWith(target *Term, value *Term) *Expr {
	cpy := *expr
	cpy.With = append(cpy.With, &With{Target: target, Value: value})
	return &cpy
}
1264734
func feBytesLE(a, b *[32]byte) int32 {
	equalSoFar := int32(-1)
	greater := int32(0)

	for i := uint(31); i < 32; i-- {
		x := int32(a[i])
		y := int32(b[i])

		greater = (^equalSoFar & greater) | (equalSoFar & ((x - y) >> 31))
		equalSoFar = equalSoFar & (((x ^ y) - 1) >> 31)
	}

	return int32(^equalSoFar & 1 & greater)
}
126913
func (j *JsonQuery) Int(s ...string) (int, error) {
	val, err := rquery(j.blob, s...)
	if err != nil {
		return 0, err
	}
	return intFromInterface(val)
}
241046
func (v Value) Int() (int, error) {
	i, err := strconv.Atoi(v.String())
	if err != nil {
		return 0, v.invalidTypeError(err, "int")
	}
	return i, nil
}
1009987
func (intstr *IntOrString) IntValue() int {
	if intstr.Type == String {
		i, _ := strconv.Atoi(intstr.StrVal)
		return i
	}
	return int(intstr.IntVal)
}
949024
func iface2int(a interface{}) (int, error) {
	switch a.(type) {
	case int:
		return a.(int), nil
	}
	return 0, fmt.Errorf("redis: %#v is not integer", a)
}
141282
func (i Int) Int64() (_ int64, ok bool) {
	x, acc := bigintToInt64(i.bigint)
	if acc != big.Exact {
		return // inexact
	}
	return x, true
}
146728
func isInternal(n *node) bool {
	if n == nil {
		return false
	}
	return n.entry == nil
}