MCPcopy Index your code
hub / github.com/google/codesearch / findList

Method findList

index/read.go:196–215  ·  view source on GitHub ↗
(trigram uint32)

Source from the content-addressed store, hash-verified

194}
195
196func (ix *Index) findList(trigram uint32) (count int, offset uint32) {
197 // binary search
198 d := ix.slice(ix.postIndex, postEntrySize*ix.numPost)
199 i := sort.Search(ix.numPost, func(i int) bool {
200 i *= postEntrySize
201 t := uint32(d[i])<<16 | uint32(d[i+1])<<8 | uint32(d[i+2])
202 return t >= trigram
203 })
204 if i >= ix.numPost {
205 return 0, 0
206 }
207 i *= postEntrySize
208 t := uint32(d[i])<<16 | uint32(d[i+1])<<8 | uint32(d[i+2])
209 if t != trigram {
210 return 0, 0
211 }
212 count = int(binary.BigEndian.Uint32(d[i+3:]))
213 offset = binary.BigEndian.Uint32(d[i+3+4:])
214 return
215}
216
217type postReader struct {
218 ix *Index

Callers 1

initMethod · 0.80

Calls 1

sliceMethod · 0.95

Tested by

no test coverage detected