...
1
2
3
4 package bitset
5
6
7
8
9
10 func hasAsm() bool
11
12
13 var useAsm = hasAsm()
14
15
16
17 func popcntSliceAsm(s []uint64) uint64
18
19
20
21 func popcntMaskSliceAsm(s, m []uint64) uint64
22
23
24
25 func popcntAndSliceAsm(s, m []uint64) uint64
26
27
28
29 func popcntOrSliceAsm(s, m []uint64) uint64
30
31
32
33 func popcntXorSliceAsm(s, m []uint64) uint64
34
35 func popcntSlice(s []uint64) uint64 {
36 if useAsm {
37 return popcntSliceAsm(s)
38 }
39 return popcntSliceGo(s)
40 }
41
42 func popcntMaskSlice(s, m []uint64) uint64 {
43 if useAsm {
44 return popcntMaskSliceAsm(s, m)
45 }
46 return popcntMaskSliceGo(s, m)
47 }
48
49 func popcntAndSlice(s, m []uint64) uint64 {
50 if useAsm {
51 return popcntAndSliceAsm(s, m)
52 }
53 return popcntAndSliceGo(s, m)
54 }
55
56 func popcntOrSlice(s, m []uint64) uint64 {
57 if useAsm {
58 return popcntOrSliceAsm(s, m)
59 }
60 return popcntOrSliceGo(s, m)
61 }
62
63 func popcntXorSlice(s, m []uint64) uint64 {
64 if useAsm {
65 return popcntXorSliceAsm(s, m)
66 }
67 return popcntXorSliceGo(s, m)
68 }
69
View as plain text