// IPInRange returns true if ip is between (inclusive) start and stop.
975755
func IPInRange(start, stop, ip net.IP) bool {
	return !(IPLess(ip, start) || IPLess(stop, ip))
}
372857
func IsInRange(value, left, right float64) bool {
	if left > right {
		left, right = right, left
	}
	return value >= left && value <= right
}
1237865
func WeekdayInRange(t time.Time, minWeekday, maxWeekday time.Weekday) bool {
	return (minWeekday <= t.Weekday()) && (t.Weekday() <= maxWeekday)
}
180497
func YearInRange(t time.Time, minYear, maxYear int) bool {
	return (minYear <= t.Year()) && (t.Year() <= maxYear)
}
724255
func NetworkRange(network *net.IPNet) (net.IP, net.IP) {
	if network == nil {
		return nil, nil
	}

	firstIP := network.IP.Mask(network.Mask)
	lastIP := types.GetIPCopy(firstIP)
	for i := 0; i < len(firstIP); i++ {
		lastIP[i] = firstIP[i] | ^network.Mask[i]
	}

	if network.IP.To4() != nil {
		firstIP = firstIP.To4()
		lastIP = lastIP.To4()
	}

	return firstIP, lastIP
}
828509
func (a *IPRangeAllocator) IPRange() *IPRange {
	a.mutex.Lock()
	defer a.mutex.Unlock()

	return &IPRange{
		Start: a.ipRange.Start,
		End:   a.ipRange.End,
		Mask:  a.ipRange.Mask,
	}
}
607556
func (a *IPRangeAllocator) Reserve(ip net.IP) {
	a.mutex.Lock()
	defer a.mutex.Unlock()

	// ensure the specified IP is within the range
	if !a.ipRange.Contains(ip) {
		return
	}

	// calculate the idx from the start
	ipBig := big.NewInt(0)
	ipBig.SetBytes(ip)
	idx := ipBig.Sub(ipBig, a.startBig).Int64()

	// if it isn't already reserved, then mark it reserved and decrement the
	// remaining count
	if !a.reserved[idx] {
		a.reserved[idx] = true
		a.remaining--
	}
}
466228
func (ac *arrayContainer) iaddRange(firstOfRange, endx int) container {
	if firstOfRange >= endx {
		return ac
	}
	indexstart := binarySearch(ac.content, uint16(firstOfRange))
	if indexstart < 0 {
		indexstart = -indexstart - 1
	}
	indexend := binarySearch(ac.content, uint16(endx-1))
	if indexend < 0 {
		indexend = -indexend - 1
	} else {
		indexend++
	}
	rangelength := endx - firstOfRange
	newcardinality := indexstart + (ac.getCardinality() - indexend) + rangelength
	if newcardinality > arrayDefaultMaxSize {
		a := ac.toBitmapContainer()
		return a.iaddRange(firstOfRange, endx)
	}
	if cap(ac.content) < newcardinality {
		tmp := make([]uint16, newcardinality, newcardinality)
		copy(tmp[:indexstart], ac.content[:indexstart])
		copy(tmp[indexstart+rangelength:], ac.content[indexend:])

		ac.content = tmp
	} else {
		ac.content = ac.content[:newcardinality]
		copy(ac.content[indexstart+rangelength:], ac.content[indexend:])

	}
	for k := 0; k < rangelength; k++ {
		ac.content[k+indexstart] = uint16(firstOfRange + k)
	}
	return ac
}
539690
func MonthInRange(t time.Time, minMonth, maxMonth time.Month) bool {
	return (minMonth <= t.Month()) && (t.Month() <= maxMonth)
}
1085330
func (mr *mr_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {

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

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

	return locales.PluralRuleOther

}
174176
func InRange(value interface{}, left interface{}, right interface{}) bool {

	reflectValue := reflect.TypeOf(value).Kind()
	reflectLeft := reflect.TypeOf(left).Kind()
	reflectRight := reflect.TypeOf(right).Kind()

	if reflectValue == reflect.Int && reflectLeft == reflect.Int && reflectRight == reflect.Int {
		return InRangeInt(value.(int), left.(int), right.(int))
	} else if reflectValue == reflect.Float32 && reflectLeft == reflect.Float32 && reflectRight == reflect.Float32 {
		return InRangeFloat32(value.(float32), left.(float32), right.(float32))
	} else if reflectValue == reflect.Float64 && reflectLeft == reflect.Float64 && reflectRight == reflect.Float64 {
		return InRangeFloat64(value.(float64), left.(float64), right.(float64))
	} else {
		return false
	}
}
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
}
311444
func ClearIPAddrRange(ipAllocMap *bitset.BitSet, ipPool string, nwSubnetIP string, nwSubnetLen uint) error {

	addrRangeList := strings.Split(ipPool, "-")

	hostMin, err := GetIPNumber(nwSubnetIP, nwSubnetLen, 32, addrRangeList[0])
	if err != nil {
		log.Errorf("Error parsing first address %s. Err: %v", addrRangeList[0], err)
		return err
	}

	hostMax, err := GetIPNumber(nwSubnetIP, nwSubnetLen, 32, addrRangeList[1])
	if err != nil {
		log.Errorf("Error parsing last address %s. Err: %v", addrRangeList[1], err)
		return err
	}

	// Clear a range
	for i := hostMin; i <= hostMax; i++ {
		ipAllocMap.Clear(uint(i))
	}

	return nil
}
257647
func IsInRange(value int, min int, max int) []string {
	if value >= min && value <= max {
		return nil
	}
	return []string{InclusiveRangeError(min, max)}
}
833375
func (rc *runContainer16) iaddRange(firstOfRange, endx int) container {

	if firstOfRange >= endx {
		panic(fmt.Sprintf("invalid %v = endx >= firstOfRange", endx))
	}
	addme := newRunContainer16TakeOwnership([]interval16{
		{
			start:  uint16(firstOfRange),
			length: uint16(endx - 1 - firstOfRange),
		},
	})
	*rc = *rc.union(addme)
	return rc
}
569119
func UInt8Range(min, max uint8) gopter.Gen {
	return UInt64Range(uint64(min), uint64(max)).
		Map(uint64To8).
		WithShrinker(UInt8Shrinker).
		SuchThat(func(v uint8) bool {
			return v >= min && v <= max
		})
}
281873
func UIntRange(min, max uint) gopter.Gen {
	return UInt64Range(uint64(min), uint64(max)).
		Map(uint64ToUint).
		WithShrinker(UIntShrinker).
		SuchThat(func(v uint) bool {
			return v >= min && v <= max
		})
}