We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b01db02 commit 9b1e7cfCopy full SHA for 9b1e7cf
src/math/bits/example_test.go
@@ -36,3 +36,43 @@ func ExampleLeadingZeros64() {
36
// 64
37
// 63
38
}
39
+
40
+func ExampleOnesCount() {
41
+ fmt.Printf("%b\n", 14)
42
+ fmt.Println(bits.OnesCount(14))
43
+ // Output:
44
+ // 1110
45
+ // 3
46
+}
47
48
+func ExampleOnesCount8() {
49
50
+ fmt.Println(bits.OnesCount8(14))
51
52
53
54
55
56
+func ExampleOnesCount16() {
57
58
+ fmt.Println(bits.OnesCount16(14))
59
60
61
62
63
64
+func ExampleOnesCount32() {
65
66
+ fmt.Println(bits.OnesCount32(14))
67
68
69
70
71
72
+func ExampleOnesCount64() {
73
74
75
76
77
78
0 commit comments