// intMaxRange returns the furthest right position held by the subtree
// rooted at root, assuming that the left and right nodes have correct
// range extents.
494403
func intMaxRange(root, left, right *IntNode) int {
	end := root.Interval.End
	if left != nil && left.Range.End > end {
		end = left.Range.End
	}
	if right != nil && right.Range.End > end {
		end = right.Range.End
	}
	return end
}
562026
func inRange(r headerutil.Range) scope {
	var scope composedScope

	if r.Max != nil {
		scope = append(scope, limit(*r.Max))
	}

	if r.Sort != nil && r.Order != nil {
		o := fmt.Sprintf("%s %s", *r.Sort, *r.Order)
		scope = append(scope, order(o))
	}

	return scope
}
88816
func (b *Bitmap) OffsetRange(offset, start, end uint64) *Bitmap {
	if lowbits(offset) != 0 {
		panic("offset must not contain low bits")
	}
	if lowbits(start) != 0 {
		panic("range start must not contain low bits")
	}
	if lowbits(end) != 0 {
		panic("range end must not contain low bits")
	}

	off := highbits(offset)
	hi0, hi1 := highbits(start), highbits(end)
	citer, _ := b.Containers.Iterator(hi0)
	other := NewBitmap()
	for citer.Next() {
		k, c := citer.Value()
		if k >= hi1 {
			break
		}
		other.Containers.Put(off+(k-hi0), c)
	}
	return other
}
1135834
func Right(a []int, v int) int {
	return bisectRightRange(a, v, 0, len(a))
}
434642
func (t *LLRB) AscendRange(greaterOrEqual, lessThan Item, iterator ItemIterator) {
	t.ascendRange(t.root, greaterOrEqual, lessThan, iterator)
}
578015
func (b Bitmap) IndexesInRange(set bool, from, to uint) []int {
	var indexes []int
	for i := from; i <= to && i < b.Size(); i++ {
		c := b.Check(i)
		if c && set || !c && !set {
			indexes = append(indexes, int(i))
		}
	}

	return indexes
}
1265290
func IPRange(start, stop net.IP) int {
	return int(binary.BigEndian.Uint32(stop.To4())) - int(binary.BigEndian.Uint32(start.To4())) + 1
}
38379
func (b *Bitmap) ForEachRange(start, end uint64, fn func(uint64)) {
	itr := b.Iterator()
	itr.Seek(start)
	for v, eof := itr.Next(); !eof && v < end; v, eof = itr.Next() {
		fn(v)
	}
}
658776
func LogarithmicRange(min, max int, cb func(int)) {
	if min == 0 {
		min = 1
	}
	for n := CeilToPowerOfTwo(min); n <= max; n <<= 1 {
		cb(n)
	}
}
828359
func (v Value) InRange(a, b Value) bool {
	return v-a < b-a
}
808402
func IsInRange(value int, min int, max int) error {
	if value >= min && value <= max {
		return nil
	}
	return InclusiveRangeError(min, max)
}
14799
func FullRange() []*Range {
	return []*Range{{LowVal: []types.Datum{{}}, HighVal: []types.Datum{types.MaxValueDatum()}}}
}
600322
func (db *DB) RangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator {
	return NewRangeLimitIterator(db.NewIterator(), &Range{min, max, rangeType}, &Limit{offset, count})
}
1018606
func Range(start, end int) []float64 {
	size := end - start
	incr := true
	if start > end {
		incr = false
		size = start - end
	}

	if size < 0 {
		panic("Cannot create a float range that is negative in size")
	}

	r := make([]float64, size)
	for i, v := 0, float64(start); i < size; i++ {
		r[i] = v

		if incr {
			v++
		} else {
			v--
		}
	}
	return r
}
1209555
func (b *Bitmap) SliceRange(start, end uint64) []uint64 {
	var a []uint64
	itr := b.Iterator()
	itr.Seek(start)
	for v, eof := itr.Next(); !eof && v < end; v, eof = itr.Next() {
		a = append(a, v)
	}
	return a
}
845707
func Max(data Interface) (max float64, max_index int) {
	Len := data.Len()
	max = data.Get(0)

	for i := 0; i < Len; i++ {
		xi := data.Get(i)

		if xi > max {
			max = xi
			max_index = i
		}

		if math.IsNaN(xi) {
			max = xi
			max_index = i
			return
		}
	}

	return
}
139596
func Int8Range(min, max int8) gopter.Gen {
	return Int64Range(int64(min), int64(max)).
		Map(int64To8).
		WithShrinker(Int8Shrinker).
		SuchThat(func(v int8) bool {
			return v >= min && v <= max
		})
}