// flip the values in the range [firstOfRange,endx)
339501
func (rc *runContainer16) inot(firstOfRange, endx int) container {
	if firstOfRange >= endx {
		panic(fmt.Sprintf("invalid %v = endx >= firstOfRange = %v", endx, firstOfRange))
	}
	// TODO: minimize copies, do it all inplace; not() makes a copy.
	rc = rc.Not(firstOfRange, endx)
	return rc
}
222592
func (i *Image) Flip() ([]byte, error) {
	options := Options{Flip: true}
	return i.Process(options)
}
797246
func (pw *Writer) WriteOffset(ofs uint, pe *Encoder, re *RangeEncoder) {
	sym := re.Encode(ofs)
	pw.WriteSymbol(sym, pe)
	rc := re.rcs[sym]
	pw.WriteBits(ofs-uint(rc.Base), uint(rc.Len))
}
52
func Range(str string, params ...string) bool {
	if len(params) == 2 {
		value, _ := ToFloat(str)
		min, _ := ToFloat(params[0])
		max, _ := ToFloat(params[1])
		return InRange(value, min, max)
	}

	return false
}
705446
func First(i interface{}) (interface{}, error) {
	t := reflect.TypeOf(i)
	v := reflect.ValueOf(i)

	switch t.Kind() {
	case reflect.Array, reflect.Slice:
	default:
		return nil, fmt.Errorf("value is nither Slice nor Array")
	}

	if v.Len() == 0 {
		return nil, fmt.Errorf("empty array")
	}

	return v.Index(0).Interface(), nil
}
711773
func (db *BytesConnectionEtcd) ListValuesRange(fromPrefix string, toPrefix string) (keyval.BytesKeyValIterator, error) {
	return listValuesRangeInternal(db.Logger, db.etcdClient, db.opTimeout, fromPrefix, toPrefix)
}
1373292
func splitRange(value string) (string, string, error) {
	p := strings.SplitN(value, ",", 2)
	if len(p) != 2 || p[0] == "" || p[1] == "" {
		return "", "", fmt.Errorf("date: failed to parse date range '%s'", value)
	}
	return strings.ToLower(p[0][1:]), strings.ToLower(p[1][:len(p[1])-1]), nil
}
1267411
func InRangeInt(value, left, right interface{}) bool {
	value64, _ := ToInt(value)
	left64, _ := ToInt(left)
	right64, _ := ToInt(right)
	if left64 > right64 {
		left64, right64 = right64, left64
	}
	return value64 >= left64 && value64 <= right64
}
352329
func (array orderTabletsForSwap) Swap(i, j int) {
	array[i], array[j] = array[j], array[i]
}
962024
func (s *BatchListIndex) SetRangesOnIndexedValues(v []*ObjectAttributeRange) *BatchListIndex {
	s.RangesOnIndexedValues = v
	return s
}
900015
func RangeEnd(key []byte) []byte {
	end := make([]byte, len(key))
	copy(end, key)
	for i := len(end) - 1; i >= 0; i-- {
		if end[i] < 0xff {
			end[i] = end[i] + 1
			end = end[:i+1]
			return end
		}
	}
	// next key does not exist (e.g., 0xffff);
	return noEnd
}
197091
func (c *RangeCursor) First() ([]byte, []byte) {
	if c.Reverse {
		k, v := c.C.Seek(c.Max)

		// If Seek doesn't find a key it goes to the next.
		// If so, we need to get the previous one to avoid
		// including bigger values. #218
		if !bytes.HasPrefix(k, c.Max) && k != nil {
			k, v = c.C.Prev()
		}

		return k, v
	}

	return c.C.Seek(c.Min)
}
476034
func (dt *doneTODOs) Range() (reflect.Value, reflect.Value, bool) {
	for dt.i < dt.len {
		key := dt.keys[dt.i]
		dt.i++
		if dt.list[key].Done {
			return reflect.ValueOf(key), reflect.ValueOf(dt.list[key]), false
		}
	}
	return reflect.Value{}, reflect.Value{}, true
}
1288150
func (vm *Machine) FlipXY() {
	for idx := range vm.Positions {
		pos := vm.Positions[idx]
		vm.Positions[idx].X, vm.Positions[idx].Y = pos.Y, pos.X
	}
}
1193427
func (slice Sessions) Swap(i, j int) {
	s := slice[i]
	slice[i] = slice[j]
	slice[j] = s
}
1274507
func (ung UniformGenerator) ShuffleRange(arr []interface{}, low, high int) {
	if low < 0 || low > high || high >= len(arr) {
		panic(fmt.Sprintf("Illegal subarray range %d ~ %d", low, high))
	}
	for i := low; i <= high; i++ {
		r := int32(i) + ung.Int32n(int32(high-i+1))
		arr[i], arr[r] = arr[r], arr[i]
	}
}
87397
func (s *Bitset) Flip(index uint) *Bitset {
	if index >= s.Length(0) {
		s.Set(index)
	}
	s.set[unitPos(index)] ^= 1 << unitIndex(index)

	return s
}