Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 203 for shifts (0.53 sec)

  1. src/go/types/testdata/local/shifts.go

    // Copyright 2022 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // The following shift tests are disabled in the shared
    // testdata/check/shifts.go file because they don't work
    // correctly with types2 at the moment. See go.dev/issue/52080.
    // Make sure we keep testing them with go/types.
    //
    // TODO(gri) Once go.dev/issue/52080 is fixed, this file can be
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 01 21:31:01 UTC 2023
    - 886 bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go

    			}
    		}
    	})
    	return nil, nil
    }
    
    // checkLongShift checks if shift or shift-assign operations shift by more than
    // the length of the underlying variable.
    func checkLongShift(pass *analysis.Pass, node ast.Node, x, y ast.Expr) {
    	if pass.TypesInfo.Types[x].Value != nil {
    		// Ignore shifts of constants.
    		// These are frequently used for bit-twiddling tricks
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  3. test/shift1.go

    	_ = 1<<s == 1.  // ERROR "invalid|shift of type float64"
    	_ = 1.<<s == 1  // ERROR "invalid|shift of type float64"
    	_ = 1.<<s == 1. // ERROR "invalid|non-integer|shift of type float64"
    
    	_ = 1<<s+1 == 1
    	_ = 1<<s+1 == 1.   // ERROR "invalid|shift of type float64"
    	_ = 1<<s+1. == 1   // ERROR "invalid|shift of type float64"
    	_ = 1<<s+1. == 1.  // ERROR "invalid|shift of type float64"
    	_ = 1.<<s+1 == 1   // ERROR "invalid|shift of type float64"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 03 16:24:32 UTC 2021
    - 9.4K bytes
    - Viewed (0)
  4. test/codegen/bitfield.go

    	return x<<7 ^ x2>>25 // arm64:"EXTRW\t[$]25,"
    }
    
    // check 32-bit shift masking
    func mask32(x uint32) uint32 {
    	return (x << 29) >> 29 // arm64:"AND\t[$]7, R[0-9]+",-"LSR",-"LSL"
    }
    
    // check 16-bit shift masking
    func mask16(x uint16) uint16 {
    	return (x << 14) >> 14 // arm64:"AND\t[$]3, R[0-9]+",-"LSR",-"LSL"
    }
    
    // check 8-bit shift masking
    func mask8(x uint8) uint8 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 23 06:11:32 UTC 2022
    - 9.6K bytes
    - Viewed (0)
  5. src/internal/types/testdata/fixedbugs/issue52031.go

    // Example from #52031.
    //
    // The following shifts should not produce errors on Go < 1.13, as their
    // untyped constant operands are representable by type uint.
    const (
    	_ resultFlags = (1 << iota) / 2
    
    	reportEqual
    	reportUnequal
    	reportByIgnore
    	reportByMethod
    	reportByFunc
    	reportByCycle
    )
    
    // Invalid cases.
    var x int = 1
    var _ = (8 << x /* ERRORx `signed shift count .* requires go1.13 or later` */)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:27 UTC 2023
    - 733 bytes
    - Viewed (0)
  6. test/fixedbugs/issue28079c.go

    // license that can be found in the LICENSE file.
    
    // Non-Go-constant but constant values aren't ok for shifts.
    
    package p
    
    import "unsafe"
    
    func f() {
    	_ = complex(1<<uintptr(unsafe.Pointer(nil)), 0) // ERROR "invalid operation: shifted operand 1 \(type float64\) must be integer|non-integer type for left operand of shift"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 28 22:28:41 UTC 2022
    - 451 bytes
    - Viewed (0)
  7. test/fixedbugs/issue50854.go

    //go:noinline
    func f(p int64, x, y int64) bool { return -x <= p && p <= y }
    
    //go:noinline
    func g(p int32, x, y int32) bool { return -x <= p && p <= y }
    
    // There are some more complicated patterns involving compares and shifts, try to trigger those.
    
    //go:noinline
    func h(p int64, x, y int64) bool { return -(x<<1) <= p && p <= y }
    
    //go:noinline
    func k(p int32, x, y int32) bool { return -(1<<x) <= p && p <= y }
    
    //go:noinline
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jan 27 19:52:52 UTC 2022
    - 890 bytes
    - Viewed (0)
  8. src/compress/bzip2/bit_reader.go

    	//        |-----|
    	//        V     V
    	//      0101101101001110
    	//        ^            ^
    	//        |------------|
    	//           br.bits (num valid bits)
    	//
    	// The next line right shifts the desired bits into the
    	// least-significant places and masks off anything above.
    	n = (br.n >> (br.bits - bits)) & ((1 << bits) - 1)
    	br.bits -= bits
    	return
    }
    
    func (br *bitReader) ReadBits(bits uint) (n int) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 23:20:03 UTC 2023
    - 2K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/test/testdata/gen/arithConstGen.go

    						fncCnst1.Execute(w, fd)
    						fd.Number = number
    					}
    
    					fncCnst2.Execute(w, fd)
    				}
    			}
    
    			// signed test cases
    			if len(s.i) > 0 {
    				// don't generate tests for shifts by signed integers
    				if o.name == "lsh" || o.name == "rsh" {
    					continue
    				}
    				for _, i := range s.i {
    					fd.Number = fmt.Sprintf("%d", i)
    					fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 20 02:13:02 UTC 2022
    - 8.3K bytes
    - Viewed (0)
  10. src/cmd/vet/doc.go

    	nilfunc          check for useless comparisons between functions and nil
    	printf           check consistency of Printf format strings and arguments
    	shift            check for shifts that equal or exceed the width of the integer
    	sigchanyzer      check for unbuffered channel of os.Signal
    	slog             check for invalid structured logging calls
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 21 00:17:30 UTC 2023
    - 3.8K bytes
    - Viewed (0)
Back to top