// Reverse a slice.
196387
func Reverse(slice interface{}) {
	s := reverser{New(slice, nil, 0)}
	if s.Len() < 2 {
		return
	}
	s.itemType = s.Slice.Index(0).Type()
	ReverseInterface(s)
}
170241
func (k *Kubernetes) Reverse(ctx context.Context, state request.Request, exact bool, opt plugin.Options) ([]msg.Service, error) {

	ip := dnsutil.ExtractAddressFromReverse(state.Name())
	if ip == "" {
		_, e := k.Records(ctx, state, exact)
		return nil, e
	}

	records := k.serviceRecordForIP(ip, state.Name())
	if len(records) == 0 {
		return records, errNoItems
	}
	return records, nil
}
1345937
func (list *List) Slice(from, to int) []string {
	if list.length == 0 {
		return emptySlice()
	}
	if from >= list.length || to >= list.length || from < 0 || to < 0 || from > to {
		return emptySlice()
	}
	if from == to {
		return oneSlice(list.Get(from))
	}
	diff := to - from + 1
	result := make([]string, diff)
	tmp := list.first
	for i := 0; i < list.length; i++ {
		if i >= from && i <= to {
			result[i-from] = tmp.Content
		}
		if i >= to {
			break
		}
		tmp = tmp.Next
	}
	return result
}
199085
func (db *GoLevelDB) ReverseIterator(start, end []byte) Iterator {
	itr := db.db.NewIterator(nil, nil)
	return newGoLevelDBIterator(itr, start, end, true)
}
700508
func (ls LineString) Reverse() {
	l := len(ls) - 1
	for i := 0; i <= l/2; i++ {
		ls[i], ls[l-i] = ls[l-i], ls[i]
	}
}
233748
func ReverseStrings(s []string) []string {
	for i, j := 0, len(s)-1; i < len(s)/2; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return s
}
612685
func (r *Render) backward(from, n int) int {
	return r.move(from, from-n)
}
714791
func (bp *Bypass) Reversed() bool {
	bp.mux.RLock()
	defer bp.mux.RUnlock()

	return bp.reversed
}
872803
func reverse(b []byte) []byte {
	size := len(b)
	c := make([]byte, size)

	for i, j := size-1, 0; i >= 0; i, j = i-1, j+1 {
		c[j] = b[i]
	}

	return c
}
926382
func Reverse(xs interface{}) interface{} {
	chk := ty.Check(
		new(func([]ty.A) []ty.A),
		xs)
	vxs, tys := chk.Args[0], chk.Returns[0]

	xsLen := vxs.Len()
	vys := reflect.MakeSlice(tys, xsLen, xsLen)
	for i := 0; i < xsLen; i++ {
		vys.Index(i).Set(vxs.Index(xsLen - 1 - i))
	}
	return vys.Interface()
}
426362
func (l *Line) Reverse() *Line {
	l.a, l.b = l.b, l.a
	return l
}
1217921
func (s *BytesStore) reverse(srcPos, destPos int64) {
	assert(srcPos < destPos)
	assert(destPos < s.position())
	// fmt.Printf("reverse src=%v dest=%v\n", srcPos, destPos)

	srcBlockIndex := int(srcPos >> s.blockBits)
	src := int(srcPos & int64(s.blockMask))
	srcBlock := s.blocks[srcBlockIndex]

	destBlockIndex := int(destPos >> s.blockBits)
	dest := int(destPos & int64(s.blockMask))
	destBlock := s.blocks[destBlockIndex]

	// fmt.Printf("  srcBlock=%v destBlock=%v\n", srcBlockIndex, destBlockIndex)

	limit := int((destPos - srcPos + 1) / 2)
	for i := 0; i < limit; i++ {
		// fmt.Printf("  cycle src=%v dest=%v\n", src, dest)
		srcBlock[src], destBlock[dest] = destBlock[dest], srcBlock[src]
		if src++; src == int(s.blockSize) {
			srcBlockIndex++
			srcBlock = s.blocks[srcBlockIndex]
			fmt.Printf("  set destBlock=%v srcBlock=%v\n", destBlock, srcBlock)
			src = 0
		}

		if dest--; dest == -1 {
			destBlockIndex--
			destBlock = s.blocks[destBlockIndex]
			fmt.Printf("  set destBlock=%v srcBlock=%v\n", destBlock, srcBlock)
			dest = int(s.blockSize - 1)
		}
	}
}
1288343
func (t *kutenTable) Reverse() {
	t.once.Do(func() {
		t.FromUnicode = make([][2]byte, 65536)
		for ku := range t.Data {
			for ten, unicode := range t.Data[ku] {
				t.FromUnicode[unicode] = [2]byte{byte(ku), byte(ten)}
			}
		}
	})
}
993123
func Reverse32(value uint32) (uint32) {
    value = ((value >> 1) & 0x55555555) | ((value & 0x55555555) << 1)
    value = ((value >> 2) & 0x33333333) | ((value & 0x33333333) << 2)
    value = ((value >> 4) & 0x0F0F0F0F) | ((value & 0x0F0F0F0F) << 4)
    value = ((value >> 8) & 0x00FF00FF) | ((value & 0x00FF00FF) << 8)
    value = ( value >> 16             ) | ( value               << 16)

    return value
}
667947
func (ss *SortedSlice) ReversedIter(idx ...int) (c chan Sortable) {
	c = make(chan Sortable)
	i, j := 0, len(ss.s)-1
	if len(idx) >= 1 {
		i = idx[0]
	}
	if len(idx) >= 2 {
		j = idx[1]
	}
	if i < len(ss.s) && j < len(ss.s) && i <= j && i >= 0 {
		go func() {
			defer close(c)
			for k := len(ss.s) - 1 - i; k >= len(ss.s)-1-j; k-- {
				v := ss.s[k]
				c <- v
			}
		}()
	} else {
		close(c)
	}
	return c
}
1107453
func Reversed() func(Call) error {
	return func(g Call) error {
		scan, ok := g.(*Scan)
		if !ok {
			return errors.New("'Reversed' option can only be used with Scan queries")
		}
		scan.reversed = true
		return nil
	}
}
16624
func reverse(a *Automaton) (*Automaton, map[int]bool) {
	if isEmpty(a) {
		return newEmptyAutomaton(), nil
	}

	numStates := a.numStates()

	// build a new automaton with all edges reversed
	b := newAutomatonBuilder()

	// initial node; we'll add epsilon transitions in the end:
	b.createState()
	for s := 0; s < numStates; s++ {
		b.createState()
	}

	// old initial state becomes new accept state:
	b.setAccept(1, true)

	t := newTransition()
	for s := 0; s < numStates; s++ {
		numTransitions := a.numTransitions(s)
		a.initTransition(s, t)
		for i := 0; i < numTransitions; i++ {
			a.nextTransition(t)
			b.addTransitionRange(t.dest+1, s+1, t.min, t.max)
		}
	}

	ans := b.finish()
	initialStates := make(map[int]bool)

	acceptStates := a.isAccept
	for s := acceptStates.NextSetBit(0); s != -1; s = acceptStates.NextSetBit(s + 1) {
		ans.addEpsilon(0, int(s+1))
		initialStates[int(s+1)] = true
	}

	ans.finishState()
	return ans, initialStates
}