Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for OnesCount64 (0.15 sec)

  1. 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)
  2. pkg/registry/core/service/allocator/utils.go

    package allocator
    
    import (
    	"math/big"
    	"math/bits"
    )
    
    // countBits returns the number of set bits in n
    func countBits(n *big.Int) int {
    	var count int = 0
    	for _, w := range n.Bits() {
    		count += bits.OnesCount64(uint64(w))
    	}
    	return count
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Oct 01 15:09:56 UTC 2021
    - 816 bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. pkg/kubelet/cm/topologymanager/bitmask/bitmask.go

    		}
    	}
    	return fmt.Sprintf("%0"+strconv.Itoa(grouping)+"b", *s)
    }
    
    // Count counts number of bits in mask set to one
    func (s *bitMask) Count() int {
    	return bits.OnesCount64(uint64(*s))
    }
    
    // Getbits returns each bit number with bits set to one
    func (s *bitMask) GetBits() []int {
    	var bits []int
    	for i := uint64(0); i < 64; i++ {
    		if (*s & (1 << i)) > 0 {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Nov 03 09:45:09 UTC 2022
    - 5.1K bytes
    - Viewed (0)
Back to top