MCPcopy Index your code
hub / github.com/coder/coder / intersectSorted

Function intersectSorted

agent/filefinder/query.go:198–217  ·  view source on GitHub ↗
(a, b []uint32)

Source from the content-addressed store, hash-verified

196}
197
198func intersectSorted(a, b []uint32) []uint32 {
199 if len(a) == 0 || len(b) == 0 {
200 return nil
201 }
202 var result []uint32
203 ai, bi := 0, 0
204 for ai < len(a) && bi < len(b) {
205 switch {
206 case a[ai] < b[bi]:
207 ai++
208 case a[ai] > b[bi]:
209 bi++
210 default:
211 result = append(result, a[ai])
212 ai++
213 bi++
214 }
215 }
216 return result
217}
218
219func intersectAll(lists [][]uint32) []uint32 {
220 if len(lists) == 0 {

Callers 1

intersectAllFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected