// NaiveOffset skips a given number of results
324871
func NaiveOffset(qr Results, offset int) Results {
	return ResultsFromIterator(qr.Query(), Iterator{
		Next: func() (Result, bool) {
			for ; offset > 0; offset-- {
				res, ok := qr.NextSync()
				if !ok || res.Error != nil {
					return res, ok
				}
			}
			return qr.NextSync()
		},
		Close: func() error {
			return qr.Close()
		},
	})
}
461554
func SplitSeriesOffset(offset int64) (segmentID uint16, pos uint32) {
	return uint16((offset >> 32) & 0xFFFF), uint32(offset & 0xFFFFFFFF)
}
308331
func addIPOffset(base *big.Int, offset int) net.IP {
	return net.IP(big.NewInt(0).Add(base, big.NewInt(int64(offset))).Bytes())
}
913807
func JoinSeriesOffset(segmentID uint16, pos uint32) int64 {
	return (int64(segmentID) << 32) | int64(pos)
}
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))
}
1142752
func populateOffsets(blocks []protocol.BlockInfo) {
	var offset int64
	for i := range blocks {
		blocks[i].Offset = offset
		offset += int64(blocks[i].Size)
	}
}
262304
func randomOffset(n int) int {
	if n == 0 {
		return 0
	}

	val, err := rand.Int(rand.Reader, big.NewInt(int64(n)))
	if err != nil {
		logrus.Errorf("Failed to get a random offset: %v", err)
		return 0
	}

	return int(val.Int64())
}
1173338
func (me *Dataset) Offset(offset uint) *Dataset {
	ret := me.copy()
	ret.clauses.Offset = offset
	return ret
}
1041332
func (b *BootSectorCommon) DataOffset() uint32 {
	offset := uint32(b.RootDirOffset())
	offset += uint32(b.RootEntryCount * DirectoryEntrySize)
	return offset
}
735485
func (pr *Reader) ReadOffset(pd *Decoder, rcs RangeCodes) uint {
	rc := rcs[pr.ReadSymbol(pd)]
	return uint(rc.Base) + pr.ReadBits(uint(rc.Len))
}
426989
func (s *EventsService) SelectWithOffset(r RRSetKey, query string, offset int) ([]EventInfoDTO, ResultInfo, *http.Response, error) {
	var tld EventInfoListDTO

	uri := r.EventsQueryURI(query, offset)
	res, err := s.client.get(uri, &tld)

	pis := []EventInfoDTO{}
	for _, pi := range tld.Events {
		pis = append(pis, pi)
	}
	return pis, tld.Resultinfo, res, err
}
734155
func (p *ycc) PixOffset(x, y int) int {
	return (y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*3
}
244998
func ReleaseListOffset(offset string) ReleaseListOption {
	return func(opts *options) {
		opts.listReq.Offset = offset
	}
}
600574
func convertGenericOffsets(data interface{}) ([]uint64, error) {
	switch data.(type) {
	case uint64, float64, json.Number:
		if value, err := convertOffset(data); err != nil {
			return nil, err
		} else {
			return []uint64{value}, nil
		}
	case []json.Number:
		interfaces := data.([]json.Number)
		offsets := make([]uint64, len(interfaces))
		for i, offset := range interfaces {
			if value, err := convertOffset(offset); err != nil {
				return nil, err
			} else {
				offsets[i] = value
			}
		}
		return offsets, nil
	case []uint64:
		return data.([]uint64), nil
	case []float64:
		interfaces := data.([]float64)
		offsets := make([]uint64, len(interfaces))
		for i, offset := range interfaces {
			if value, err := convertOffset(offset); err != nil {
				return nil, err
			} else {
				offsets[i] = value
			}
		}
		return offsets, nil
	case []interface{}: // The array may not be typed.
		interfaces := data.([]interface{})
		offsets := make([]uint64, len(interfaces))
		for i, offset := range interfaces {
			if value, err := convertOffset(offset); err != nil {
				return nil, err
			} else {
				offsets[i] = value
			}
		}
		return offsets, nil
	}

	// An unexpected type. We'll get the type name for the error, but this
	// will fail the export.. so it only uses reflect once.
	name := reflect.TypeOf(data)
	return nil, &UnknownElasticStructError{fmt.Sprintf("%v", name), "offset"}
}
956475
func (d *Dashboard) NextByOffset() (*Dashboard, error) {
	if d.bySince {
		return nil, MixedPaginationMethodsError
	}
	if len(d.Posts) < 1 {
		return nil, NoNextPageError
	}
	params := copyParams(d.params)
	offset, err := strconv.Atoi(params.Get("offset"))
	if err != nil {
		offset = 0
	}
	offset += len(d.Posts)
	params.Set("offset", strconv.Itoa(offset))
	return GetDashboard(d.client, params)
}
926916
func (s *KeyPhrase) SetBeginOffset(v int64) *KeyPhrase {
	s.BeginOffset = &v
	return s
}
16550
func (p *Packfile) GetByOffset(o int64) (plumbing.EncodedObject, error) {
	hash, err := p.FindHash(o)
	if err != nil {
		return nil, err
	}

	return p.objectAtOffset(o, hash)
}