MCPcopy
hub / github.com/adonovan/gopl.io / Add

Method Add

ch6/intset/intset.go:29–35  ·  view source on GitHub ↗

Add adds the non-negative value x to the set.

(x int)

Source from the content-addressed store, hash-verified

27
28// Add adds the non-negative value x to the set.
29func (s *IntSet) Add(x int) {
30 word, bit := x/64, uint(x%64)
31 for word >= len(s.words) {
32 s.words = append(s.words, 0)
33 }
34 s.words[word] |= 1 << bit
35}
36
37// UnionWith sets s to the union of s and t.
38func (s *IntSet) UnionWith(t *IntSet) {

Callers 12

Example_oneFunction · 0.95
Example_twoFunction · 0.95
mainFunction · 0.80
WaitForServerFunction · 0.80
mainFunction · 0.80
walkDirFunction · 0.80
makeThumbnails6Function · 0.80
mainFunction · 0.80
walkDirFunction · 0.80
TestBankFunction · 0.80
ConcurrentFunction · 0.80
TestBankFunction · 0.80

Calls

no outgoing calls

Tested by 5

Example_oneFunction · 0.76
Example_twoFunction · 0.76
makeThumbnails6Function · 0.64
TestBankFunction · 0.64
TestBankFunction · 0.64