Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for OnesCount64 (0.22 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. src/runtime/gc_test.go

    		// This is a serious bug - an object is live (due to the KeepAlive
    		// call below), but isn't reported as such.
    		t.Fatalf("live object not in reachable set; want %b, got %b", want, got)
    	}
    	if bits.OnesCount64(got&^want) > 1 {
    		// Note: we can occasionally have a value that is retained even though
    		// it isn't live, due to conservative scanning of stack frames.
    		// See issue 67204. For now, we allow a "slop" of 1 unintentionally
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 05 22:33:52 UTC 2024
    - 17.6K bytes
    - Viewed (0)
  7. src/runtime/export_test.go

    			if chunk == nil {
    				continue
    			}
    			pg := chunk.scavenged.popcntRange(0, pallocChunkPages)
    			slow.HeapReleased += uint64(pg) * pageSize
    		}
    		for _, p := range allp {
    			pg := sys.OnesCount64(p.pcache.scav)
    			slow.HeapReleased += uint64(pg) * pageSize
    		}
    
    		getg().m.mallocing--
    	})
    
    	startTheWorld(stw)
    	return
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 17:50:53 UTC 2024
    - 46.1K bytes
    - Viewed (0)
Back to top