Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for OnesCount64 (0.2 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  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)
  9. test/codegen/mathbits.go

    	// ppc64x:"POPCNTD"
    	// wasm:"I64Popcnt"
    	return bits.OnesCount(n)
    }
    
    func OnesCount64(n uint64) int {
    	// amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT"
    	// amd64:"POPCNTQ"
    	// arm64:"VCNT","VUADDLV"
    	// s390x:"POPCNT"
    	// ppc64x:"POPCNTD"
    	// wasm:"I64Popcnt"
    	return bits.OnesCount64(n)
    }
    
    func OnesCount32(n uint32) int {
    	// amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:51:17 UTC 2024
    - 19.6K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/ssa/_gen/main.go

    	s := a.name
    	if s == "generic" {
    		s = ""
    	}
    	return s
    }
    
    // countRegs returns the number of set bits in the register mask.
    func countRegs(r regMask) int {
    	return bits.OnesCount64(uint64(r))
    }
    
    // for sorting a pair of integers by key
    type intPair struct {
    	key, val int
    }
    type byKey []intPair
    
    func (a byKey) Len() int           { return len(a) }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jan 19 22:42:34 UTC 2023
    - 16.9K bytes
    - Viewed (0)
Back to top