- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 21 for OnesCount64 (0.15 sec)
-
src/math/bits/example_test.go
fmt.Printf("OnesCount32(%032b) = %d\n", 14, bits.OnesCount32(14)) // Output: // OnesCount32(00000000000000000000000000001110) = 3 } func ExampleOnesCount64() { fmt.Printf("OnesCount64(%064b) = %d\n", 14, bits.OnesCount64(14)) // Output: // OnesCount64(0000000000000000000000000000000000000000000000000000000000001110) = 3 } func ExampleRotateLeft8() { fmt.Printf("%08b\n", 15) fmt.Printf("%08b\n", bits.RotateLeft8(15, 2))
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 20 18:16:09 UTC 2019 - 5.3K bytes - Viewed (0) -
pkg/registry/core/service/allocator/utils.go
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Fri Oct 01 15:09:56 UTC 2021 - 816 bytes - Viewed (0) -
src/runtime/mpagecache.go
func (c *pageCache) allocN(npages uintptr) (uintptr, uintptr) { i := findBitRange64(c.cache, uint(npages)) if i >= 64 { return 0, 0 } mask := ((uint64(1) << npages) - 1) << i scav := sys.OnesCount64(c.scav & mask) c.cache &^= mask // mark in-use bits c.scav &^= mask // clear scavenged bits return c.base + uintptr(i*pageSize), uintptr(scav) * pageSize }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Apr 19 14:30:00 UTC 2023 - 5.6K bytes - Viewed (0) -
internal/pubsub/mask.go
func (t Mask) Overlaps(other Mask) bool { return t&other != 0 } // SingleType returns whether t has a single type set. func (t Mask) SingleType() bool { return bits.OnesCount64(uint64(t)) == 1 } // FromUint64 will set a mask to the uint64 value. func (t *Mask) FromUint64(m uint64) { *t = Mask(m) } // Merge will merge other into t. func (t *Mask) Merge(other Mask) {
Registered: Sun Jun 16 00:44:34 UTC 2024 - Last Modified: Tue Jul 05 21:45:49 UTC 2022 - 1.3K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/sys/unix/affinity_linux.go
if i < len(s) { return s[i]&cpuBitsMask(cpu) != 0 } return false } // Count returns the number of CPUs in the set s. func (s *CPUSet) Count() int { c := 0 for _, b := range s { c += bits.OnesCount64(uint64(b)) } return c
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Feb 19 21:26:10 UTC 2020 - 1.9K bytes - Viewed (0) -
src/runtime/mpallocbits.go
} _ = b[i/64] j := i + n - 1 if i/64 == j/64 { return uint(sys.OnesCount64((b[i/64] >> (i % 64)) & ((1 << n) - 1))) } _ = b[j/64] s += uint(sys.OnesCount64(b[i/64] >> (i % 64))) for k := i/64 + 1; k < j/64; k++ { s += uint(sys.OnesCount64(b[k])) } s += uint(sys.OnesCount64(b[j/64] & ((1 << (j%64 + 1)) - 1))) return }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sat May 18 15:13:43 UTC 2024 - 12.5K bytes - Viewed (0) -
src/math/bits/make_examples.go
}, { name: "OnesCount", in: 14, out: [4]any{bits.OnesCount8(14), bits.OnesCount16(14), bits.OnesCount32(14), bits.OnesCount64(14)}, }, { name: "RotateLeft", in: 15, out: [4]any{bits.RotateLeft8(15, 2), bits.RotateLeft16(15, 2), bits.RotateLeft32(15, 2), bits.RotateLeft64(15, 2)},
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 23:33:27 UTC 2023 - 3K bytes - Viewed (0) -
src/runtime/internal/sys/intrinsics.go
// --- OnesCount --- const m0 = 0x5555555555555555 // 01010101 ... const m1 = 0x3333333333333333 // 00110011 ... const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ... // OnesCount64 returns the number of one bits ("population count") in x. func OnesCount64(x uint64) int { // Implementation: Parallel summing of adjacent bits. // See "Hacker's Delight", Chap. 5: Counting Bits. // The following pattern shows the general approach: //
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Mar 14 08:10:45 UTC 2023 - 7.4K bytes - Viewed (0) -
src/cmd/compile/internal/amd64/versions_test.go
for _, tt := range []struct { x uint64 want int }{ {0b00001111, 4}, {0b00001110, 3}, {0b00001100, 2}, {0b00000000, 0}, } { if got := bits.OnesCount64(tt.x); got != tt.want { t.Errorf("OnesCount64(%#x) = %d, want %d", tt.x, got, tt.want) } if got := bits.OnesCount32(uint32(tt.x)); got != tt.want { t.Errorf("OnesCount32(%#x) = %d, want %d", tt.x, got, tt.want) } } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Nov 15 20:19:15 UTC 2022 - 10.9K bytes - Viewed (0) -
src/math/bits/bits.go
func OnesCount32(x uint32) int { return int(pop8tab[x>>24] + pop8tab[x>>16&0xff] + pop8tab[x>>8&0xff] + pop8tab[x&0xff]) } // OnesCount64 returns the number of one bits ("population count") in x. func OnesCount64(x uint64) int { // Implementation: Parallel summing of adjacent bits. // See "Hacker's Delight", Chap. 5: Counting Bits. // The following pattern shows the general approach: //
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 11:59:09 UTC 2023 - 17.9K bytes - Viewed (0)