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

Method Add

sparse/set.go:39–47  ·  view source on GitHub ↗

Add adds x to the set if it is not already there.

(x uint32)

Source from the content-addressed store, hash-verified

37
38// Add adds x to the set if it is not already there.
39func (s *Set) Add(x uint32) {
40 v := s.sparse[x]
41 if v < uint32(len(s.dense)) && s.dense[v] == x {
42 return
43 }
44 n := len(s.dense)
45 s.sparse[x] = uint32(n)
46 s.dense = append(s.dense, x)
47}
48
49// Has reports whether x is in the set.
50func (s *Set) Has(x uint32) bool {

Callers 3

decMethod · 0.45
addqMethod · 0.45
TestNstateEncFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestNstateEncFunction · 0.36