Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for trailingZeros (0.19 sec)

  1. src/math/bits/make_examples.go

    	}{
    		{
    			name: "LeadingZeros",
    			in:   1,
    			out:  [4]any{bits.LeadingZeros8(1), bits.LeadingZeros16(1), bits.LeadingZeros32(1), bits.LeadingZeros64(1)},
    		},
    		{
    			name: "TrailingZeros",
    			in:   14,
    			out:  [4]any{bits.TrailingZeros8(14), bits.TrailingZeros16(14), bits.TrailingZeros32(14), bits.TrailingZeros64(14)},
    		},
    		{
    			name: "OnesCount",
    			in:   14,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:27 UTC 2023
    - 3K bytes
    - Viewed (0)
  2. test/codegen/mathbits.go

    	// arm64:"RORW"
    	// ppc64x:"ROTLW"
    	// s390x:"RLL"
    	// wasm:"I32Rotl"
    	return bits.RotateLeft32(n, m)
    }
    
    // ------------------------ //
    //    bits.TrailingZeros    //
    // ------------------------ //
    
    func TrailingZeros(n uint) int {
    	// amd64/v1,amd64/v2:"BSFQ","MOVL\t\\$64","CMOVQEQ"
    	// amd64/v3:"TZCNTQ"
    	// 386:"BSFL"
    	// arm:"CLZ"
    	// arm64:"RBIT","CLZ"
    	// s390x:"FLOGR"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:51:17 UTC 2024
    - 19.6K bytes
    - Viewed (0)
  3. src/math/bits/bits_test.go

    				}
    				if UintSize == 64 {
    					got = TrailingZeros(uint(x))
    					if got != want {
    						t.Fatalf("TrailingZeros(%#016x) == %d; want %d", x, got, want)
    					}
    				}
    			}
    		}
    	}
    }
    
    func BenchmarkTrailingZeros(b *testing.B) {
    	var s int
    	for i := 0; i < b.N; i++ {
    		s += TrailingZeros(uint(Input) << (uint(i) % UintSize))
    	}
    	Output = s
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 22 20:11:06 UTC 2020
    - 32.5K bytes
    - Viewed (0)
  4. src/math/bits/bits.go

    }
    
    // TrailingZeros returns the number of trailing zero bits in x; the result is [UintSize] for x == 0.
    func TrailingZeros(x uint) int {
    	if UintSize == 32 {
    		return TrailingZeros32(uint32(x))
    	}
    	return TrailingZeros64(uint64(x))
    }
    
    // TrailingZeros8 returns the number of trailing zero bits in x; the result is 8 for x == 0.
    func TrailingZeros8(x uint8) int {
    	return int(ntz8tab[x])
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 17.9K bytes
    - Viewed (0)
  5. src/strconv/itoa.go

    		// less than 8 which is smaller than any register width. This allows
    		// the compiler to generate better code for the shift operation.
    		shift := uint(bits.TrailingZeros(uint(base))) & 7
    		b := uint64(base)
    		m := uint(base) - 1 // == 1<<shift - 1
    		for u >= b {
    			i--
    			a[i] = digits[uint(u)&m]
    			u >>= shift
    		}
    		// u < base
    		i--
    		a[i] = digits[uint(u)]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:21:28 UTC 2024
    - 5.3K bytes
    - Viewed (0)
  6. src/runtime/mksizeclasses.go

    		spanSize := c.npages * pageSize
    		objects := spanSize / c.size
    		tailWaste := spanSize - c.size*(spanSize/c.size)
    		maxWaste := float64((c.size-prevSize-1)*objects+tailWaste) / float64(spanSize)
    		alignBits := bits.TrailingZeros(uint(c.size))
    		if alignBits > pageShift {
    			// object alignment is capped at page alignment
    			alignBits = pageShift
    		}
    		for i := range minAligns {
    			if i > alignBits {
    				minAligns[i] = 0
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 20:31:27 UTC 2024
    - 9.6K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/ssa/magic.go

    func udivisibleOK32(c int32) bool { return udivisibleOK(32, int64(c)) }
    func udivisibleOK64(c int64) bool { return udivisibleOK(64, c) }
    
    type udivisibleData struct {
    	k   int64  // trailingZeros(c)
    	m   uint64 // m * (c>>k) mod 2^n == 1 multiplicative inverse of odd portion modulo 2^n
    	max uint64 // ⎣(2^n - 1)/ c⎦ max value to for divisibility
    }
    
    func udivisible(n uint, c int64) udivisibleData {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:25 UTC 2024
    - 15.8K bytes
    - Viewed (0)
  8. api/go1.9.txt

    pkg math/bits, func RotateLeft64(uint64, int) uint64
    pkg math/bits, func RotateLeft8(uint8, int) uint8
    pkg math/bits, func TrailingZeros(uint) int
    pkg math/bits, func TrailingZeros16(uint16) int
    pkg math/bits, func TrailingZeros32(uint32) int
    pkg math/bits, func TrailingZeros64(uint64) int
    pkg math/bits, func TrailingZeros8(uint8) int
    pkg mime, var ErrInvalidMediaParameter error
    pkg mime/multipart, type FileHeader struct, Size int64
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 04 20:20:20 UTC 2021
    - 10.7K bytes
    - Viewed (0)
  9. src/math/big/natconv.go

    	if neg {
    		i++
    	}
    	s := make([]byte, i)
    
    	// convert power of two and non power of two bases separately
    	if b := Word(base); b == b&-b {
    		// shift is base b digit size in bits
    		shift := uint(bits.TrailingZeros(uint(b))) // shift > 0 because b >= 2
    		mask := Word(1<<shift - 1)
    		w := x[0]         // current word
    		nbits := uint(_W) // number of unprocessed bits in w
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 18 17:59:44 UTC 2022
    - 14.6K bytes
    - Viewed (0)
  10. src/math/big/nat.go

    	for x[i] == 0 {
    		i++
    	}
    	// x[i] != 0
    	return i*_W + uint(bits.TrailingZeros(uint(x[i])))
    }
    
    // isPow2 returns i, true when x == 2**i and 0, false otherwise.
    func (x nat) isPow2() (uint, bool) {
    	var i uint
    	for x[i] == 0 {
    		i++
    	}
    	if i == uint(len(x))-1 && x[i]&(x[i]-1) == 0 {
    		return i*_W + uint(bits.TrailingZeros(uint(x[i]))), true
    	}
    	return 0, false
    }
    
    func same(x, y nat) bool {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:31:58 UTC 2024
    - 31.7K bytes
    - Viewed (0)
Back to top