// withLexRange limits a list of sorted set elements.
509525
func withLexRange(members []string, min string, minIncl bool, max string, maxIncl bool) []string {
	if max == "-" || min == "+" {
		return nil
	}
	if min != "-" {
		if minIncl {
			for i, m := range members {
				if m >= min {
					members = members[i:]
					break
				}
			}
		} else {
			// Excluding min
			for i, m := range members {
				if m > min {
					members = members[i:]
					break
				}
			}
		}
	}
	if max != "+" {
		if maxIncl {
			for i, m := range members {
				if m > max {
					members = members[:i]
					break
				}
			}
		} else {
			// Excluding max
			for i, m := range members {
				if m >= max {
					members = members[:i]
					break
				}
			}
		}
	}
	return members
}
837363
func (db *DB) CompactRange(r Range) {
	if db.closed {
		panic(ErrDBClosed)
	}

	var start, limit *C.char
	if len(r.Start) != 0 {
		start = (*C.char)(unsafe.Pointer(&r.Start[0]))
	}
	if len(r.Limit) != 0 {
		limit = (*C.char)(unsafe.Pointer(&r.Limit[0]))
	}
	C.leveldb_compact_range(
		db.Ldb, start, C.size_t(len(r.Start)), limit, C.size_t(len(r.Limit)))
}
697377
func (tr Ranges) AddRange(r Range) Ranges {
	res := tr.clone()
	res.addRangeInPlace(r)
	return res
}
940526
func (d *Date) RangeHighExcl() time.Time {
	switch d.Precision {
	case Year:
		return d.Value.AddDate(1, 0, 0)
	case Month:
		return d.Value.AddDate(0, 1, 0)
	case Day:
		return d.Value.AddDate(0, 0, 1)
	case Minute:
		return d.Value.Add(time.Minute)
	case Second:
		return d.Value.Add(time.Second)
	case Millisecond:
		return d.Value.Add(time.Millisecond)
	default:
		return d.Value.Add(time.Millisecond)
	}
}
1331865
func (this *Parser) Range(start, end int) *OrderedChoice {
	exps := make([]Exp, (end - start)+1)
	for i := start; i <= end; i++ {
		exps[i-start] = &Terminal{this,i}
	}
	return &OrderedChoice{this,exps}
}
1119483
func mergeAllRanges(r []matchRange) []matchRange {
	sort.Slice(r, func(i, j int) bool { return r[i].first < r[j].first })
	for i := 0; i < len(r)-1; i++ {
		for i+1 < len(r) && r[i+1].first <= r[i].last {
			if r[i+1].last > r[i].last {
				r[i].last = r[i+1].last
			}
			r = append(r[:i+1], r[i+2:]...)
		}
	}
	return r
}
1334061
func (zh *zh_Hans_MO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
	return locales.PluralRuleOther
}
304394
func (s *SparseRange) ToSlice() (ret []uint32) {
	for _, itm := range s.Items {
		switch x := itm.RangeItem.(type) {
		case *RangeItem_Single:
			ret = append(ret, x.Single)
		case *RangeItem_Range:
			for i := x.Range.Low; i <= x.Range.High; i++ {
				ret = append(ret, i)
			}
		}
	}
	return
}
1096159
func (s *Shard) SetSequenceNumberRange(v *SequenceNumberRange) *Shard {
	s.SequenceNumberRange = v
	return s
}
1264454
func (s *GetObjectInput) SetRange(v string) *GetObjectInput {
	s.Range = &v
	return s
}
290994
func (db *DB) ZRangeByLex(key []byte, min []byte, max []byte, rangeType uint8, offset int, count int) ([][]byte, error) {
	if min == nil {
		min = db.zEncodeStartSetKey(key)
	} else {
		min = db.zEncodeSetKey(key, min)
	}
	if max == nil {
		max = db.zEncodeStopSetKey(key)
	} else {
		max = db.zEncodeSetKey(key, max)
	}

	it := db.bucket.RangeLimitIterator(min, max, rangeType, offset, count)
	defer it.Close()

	ay := make([][]byte, 0, 16)
	for ; it.Valid(); it.Next() {
		if _, m, err := db.zDecodeSetKey(it.Key()); err == nil {
			ay = append(ay, m)
		}
	}

	return ay, nil
}
946696
func (c *syncClient) Lrange(arg0 string, arg1 int64, arg2 int64) (result [][]byte, err Error) {
	arg0bytes := []byte(arg0)
	arg1bytes := []byte(strconv.FormatInt(arg1, 10))
	arg2bytes := []byte(strconv.FormatInt(arg2, 10))

	var resp Response
	resp, err = c.conn.ServiceRequest(&LRANGE, [][]byte{arg0bytes, arg1bytes, arg2bytes})
	if err == nil {
		result = resp.GetMultiBulkData()
	}
	return result, err

}
1330959
func (ca *ca_FR) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
	return locales.PluralRuleOther
}
175534
func withRange(v string, start, end int) string {
	s, e := redisRange(len(v), start, end, true /* string getrange symantics */)
	return v[s:e]
}
735747
func (db *DB) ZLexCount(key []byte, min []byte, max []byte, rangeType uint8) (int64, error) {
	if min == nil {
		min = db.zEncodeStartSetKey(key)
	} else {
		min = db.zEncodeSetKey(key, min)
	}
	if max == nil {
		max = db.zEncodeStopSetKey(key)
	} else {
		max = db.zEncodeSetKey(key, max)
	}

	it := db.bucket.RangeIterator(min, max, rangeType)
	defer it.Close()

	var n int64
	for ; it.Valid(); it.Next() {
		n++
	}

	return n, nil
}
561813
func (n *Node) adjustRange() {
	if n.Left == nil {
		n.Range.SetStart(n.Elem.Start())
	} else {
		n.Range.SetStart(n.Left.Range.Start())
	}
	n.Range.SetEnd(maxRange(n, n.Left, n.Right))
}
420913
func (lv *lv) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {

	start := lv.CardinalPluralRule(num1, v1)
	end := lv.CardinalPluralRule(num2, v2)

	if start == locales.PluralRuleZero && end == locales.PluralRuleZero {
		return locales.PluralRuleOther
	} else if start == locales.PluralRuleZero && end == locales.PluralRuleOne {
		return locales.PluralRuleOne
	} else if start == locales.PluralRuleZero && end == locales.PluralRuleOther {
		return locales.PluralRuleOther
	} else if start == locales.PluralRuleOne && end == locales.PluralRuleZero {
		return locales.PluralRuleOther
	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
		return locales.PluralRuleOne
	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
		return locales.PluralRuleOther
	} else if start == locales.PluralRuleOther && end == locales.PluralRuleZero {
		return locales.PluralRuleOther
	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
		return locales.PluralRuleOne
	}

	return locales.PluralRuleOther

}