// ReverseGeocode returns address for location
974593
func (d dataGeocoder) ReverseGeocode(lat, lng float64) (*geo.Address, error) {
	if address, ok := d.LocationToAddress[geo.Location{Lat: lat, Lng: lng}]; ok {
		return &address, nil
	}
	return nil, nil
}
1109314
func reverse(u []byte) []byte {
	// Special-case 16 bit UUIDS for speed.
	l := len(u)
	if l == 2 {
		return []byte{u[1], u[0]}
	}
	b := make([]byte, l)
	for i := 0; i < l/2+1; i++ {
		b[i], b[l-i-1] = u[l-i-1], u[i]
	}
	return b
}
478904
func Reverse16(x uint16) uint16 {
	return uint16(rev8tab[x>>8]) | uint16(rev8tab[x&0xff])<<8
}
88204
func Reverse(list interface{}) ([]interface{}, error) {
	l, err := interfaceSlice(list)
	if err != nil {
		return nil, err
	}

	// nifty trick from https://github.com/golang/go/wiki/SliceTricks#reversing
	for left, right := 0, len(l)-1; left < right; left, right = left+1, right-1 {
		l[left], l[right] = l[right], l[left]
	}
	return l, nil
}
410154
func reverse(s string) string {
	var rs []rune
	for len(s) > 0 {
		r, size := utf8.DecodeLastRuneInString(s)
		s = s[:len(s)-size]

		rs = append(rs, r)
	}

	return string(rs)
}
293
func Reverse(a []byte) []byte {
	for left, right := 0, len(a)-1; left < right; left, right = left+1, right-1 {
		a[left], a[right] = a[right], a[left]
	}

	return a
}
534387
func ReverseGeocode(lat float64, lng float64) (*Location, error) {
	// Query Provider
	resp, err := http.Get(reverseGeocodeURL +
		fmt.Sprintf("%f,%f&key=%s", lat, lng, apiKey))

	if err != nil {
		return nil, fmt.Errorf("Error reverse geocoding lat, long pair: <%v>", err)
	}

	defer resp.Body.Close()

	// Decode our JSON results
	var result geocodingResults
	err = decoder(resp).Decode(&result)

	if err != nil {
		return nil, fmt.Errorf("Error decoding reverse geocoding result: <%v>", err)
	}

	var location Location

	// Assign the results to the Location struct
	if len(result.Results[0].Locations) > 0 {
		location = result.Results[0].Locations[0]
	}

	return &location, nil
}
106950
func (s GeoDistanceSort) GeoDistance(geoDistance string) GeoDistanceSort {
	s.geoDistance = &geoDistance
	return s
}
223052
func Reverse(values interface{}) interface{} {
	switch values.(type) {
	case []string:
		v := values.([]string)
		for left, right := 0, len(v)-1; left < right; left, right = left+1, right-1 {
			v[left], v[right] = v[right], v[left]
		}
	case []memkv.KVPair:
		v := values.([]memkv.KVPair)
		for left, right := 0, len(v)-1; left < right; left, right = left+1, right-1 {
			v[left], v[right] = v[right], v[left]
		}
	}
	return values
}
312434
func Reverse(str string) string {
	var size int

	tail := len(str)
	buf := make([]byte, tail)
	s := buf

	for len(str) > 0 {
		_, size = utf8.DecodeRuneInString(str)
		tail -= size
		s = append(s[:tail], []byte(str[:size])...)
		str = str[size:]
	}

	return string(buf)
}
361758
func (d dataGeocoder) Geocode(address string) (*geo.Location, error) {
	addr := geo.Address{
		FormattedAddress: address,
	}
	if l, ok := d.AddressToLocation[addr]; ok {
		return &l, nil
	}

	return nil, nil
}
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
}
852816
func ExtractAddressFromReverse(reverseName string) string {
	search := ""

	f := reverse

	switch {
	case strings.HasSuffix(reverseName, IP4arpa):
		search = strings.TrimSuffix(reverseName, IP4arpa)
	case strings.HasSuffix(reverseName, IP6arpa):
		search = strings.TrimSuffix(reverseName, IP6arpa)
		f = reverse6
	default:
		return ""
	}

	// Reverse the segments and then combine them.
	return f(strings.Split(search, "."))
}
1297489
func (m *GlobalPositionInt) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS)
	binary.Read(data, binary.LittleEndian, &m.LAT)
	binary.Read(data, binary.LittleEndian, &m.LON)
	binary.Read(data, binary.LittleEndian, &m.ALT)
	binary.Read(data, binary.LittleEndian, &m.RELATIVE_ALT)
	binary.Read(data, binary.LittleEndian, &m.VX)
	binary.Read(data, binary.LittleEndian, &m.VY)
	binary.Read(data, binary.LittleEndian, &m.VZ)
	binary.Read(data, binary.LittleEndian, &m.HDG)
}
638265
func (g HTTPGeocoder) Geocode(address string) (*Location, error) {
	responseParser := g.ResponseParserFactory()

	ctx, cancel := context.WithTimeout(context.TODO(), DefaultTimeout)
	defer cancel()

	type geoResp struct {
		l *Location
		e error
	}
	ch := make(chan geoResp, 1)

	go func(ch chan geoResp) {
		if err := response(ctx, g.GeocodeURL(url.QueryEscape(address)), responseParser); err != nil {
			ch <- geoResp{
				l: nil,
				e: err,
			}
		}

		loc, err := responseParser.Location()
		ch <- geoResp{
			l: loc,
			e: err,
		}
	}(ch)

	select {
	case <-ctx.Done():
		return nil, ErrTimeout
	case res := <-ch:
		return res.l, res.e
	}
}
1372920
func location(h [4]uint64, i uint) uint64 {
	ii := uint64(i)
	return h[ii%2] + ii*h[2+(((ii+(ii%2))%4)/2)]
}
604864
func Reverse64(value uint64) (uint64) {
    high :=  Reverse32(uint32(value))
    low :=  Reverse32(uint32(value >> 32))

    return (uint64(high) << 32) | uint64(low)
}