Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 41 for int64Val (0.14 sec)

  1. src/go/constant/value.go

    	case unknownVal:
    		return 0, false
    	default:
    		panic(fmt.Sprintf("%v not an Int", x))
    	}
    }
    
    // Uint64Val returns the Go uint64 value of x and whether the result is exact;
    // x must be an [Int] or an [Unknown]. If the result is not exact, its value is undefined.
    // If x is [Unknown], the result is (0, false).
    func Uint64Val(x Value) (uint64, bool) {
    	switch x := x.(type) {
    	case int64Val:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 34K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/ir/const.go

    func ConstOverflow(v constant.Value, t *types.Type) bool {
    	switch {
    	case t.IsInteger():
    		bits := uint(8 * t.Size())
    		if t.IsUnsigned() {
    			x, ok := constant.Uint64Val(v)
    			return !ok || x>>bits != 0
    		}
    		x, ok := constant.Int64Val(v)
    		if x < 0 {
    			x = ^x
    		}
    		return !ok || x>>(bits-1) != 0
    	case t.IsFloat():
    		switch t.Size() {
    		case 4:
    			f, _ := constant.Float32Val(v)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 12 18:53:26 UTC 2023
    - 4K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/walk/expr.go

    	bits := int32(8 * n.Type().Size())
    
    	if ir.IsSmallIntConst(n) {
    		v := ir.Int64Val(n)
    		return 0 <= v && v < max
    	}
    
    	switch n.Op() {
    	case ir.OAND, ir.OANDNOT:
    		n := n.(*ir.BinaryExpr)
    		v := int64(-1)
    		switch {
    		case ir.IsSmallIntConst(n.X):
    			v = ir.Int64Val(n.X)
    		case ir.IsSmallIntConst(n.Y):
    			v = ir.Int64Val(n.Y)
    			if n.Op() == ir.OANDNOT {
    				v = ^v
    				if !sign {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:01 UTC 2024
    - 27.6K bytes
    - Viewed (0)
  4. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go

    		return
    	}
    
    	v := pass.TypesInfo.Types[y].Value
    	if v == nil {
    		return
    	}
    	u := constant.ToInt(v) // either an Int or Unknown
    	amt, ok := constant.Int64Val(u)
    	if !ok {
    		return
    	}
    	t := pass.TypesInfo.Types[x].Type
    	if t == nil {
    		return
    	}
    	var structuralTypes []types.Type
    	switch t := aliases.Unalias(t).(type) {
    	case *types.TypeParam:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  5. src/fmt/scan_test.go

    	{"22\n", &int8Val, int8(22)},
    	{"23\n", &int16Val, int16(23)},
    	{"24\n", &int32Val, int32(24)},
    	{"25\n", &int64Val, int64(25)},
    	{"127\n", &int8Val, int8(127)},
    	{"-21\n", &intVal, -21},
    	{"-22\n", &int8Val, int8(-22)},
    	{"-23\n", &int16Val, int16(-23)},
    	{"-24\n", &int32Val, int32(-24)},
    	{"-25\n", &int64Val, int64(-25)},
    	{"-128\n", &int8Val, int8(-128)},
    	{"+21\n", &intVal, +21},
    	{"+22\n", &int8Val, int8(+22)},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 23 20:25:13 UTC 2023
    - 39.3K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/types2/const.go

    		return s
    	}
    
    	switch {
    	case isInteger(typ):
    		x := constant.ToInt(x)
    		if x.Kind() != constant.Int {
    			return false
    		}
    		if rounded != nil {
    			*rounded = x
    		}
    		if x, ok := constant.Int64Val(x); ok {
    			switch typ.kind {
    			case Int:
    				var s = uint(sizeof(typ)) * 8
    				return int64(-1)<<(s-1) <= x && x <= int64(1)<<(s-1)-1
    			case Int8:
    				const s = 8
    				return -1<<(s-1) <= x && x <= 1<<(s-1)-1
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 7.5K bytes
    - Viewed (0)
  7. src/go/types/const.go

    		return s
    	}
    
    	switch {
    	case isInteger(typ):
    		x := constant.ToInt(x)
    		if x.Kind() != constant.Int {
    			return false
    		}
    		if rounded != nil {
    			*rounded = x
    		}
    		if x, ok := constant.Int64Val(x); ok {
    			switch typ.kind {
    			case Int:
    				var s = uint(sizeof(typ)) * 8
    				return int64(-1)<<(s-1) <= x && x <= int64(1)<<(s-1)-1
    			case Int8:
    				const s = 8
    				return -1<<(s-1) <= x && x <= 1<<(s-1)-1
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/typecheck/expr.go

    	n.Cap = DefaultLit(Expr(n.Cap), types.Types[types.TINT])
    
    	if ir.IsConst(n.Len, constant.Int) && ir.Int64Val(n.Len) < 0 {
    		base.Fatalf("len for OSLICEHEADER must be non-negative")
    	}
    
    	if ir.IsConst(n.Cap, constant.Int) && ir.Int64Val(n.Cap) < 0 {
    		base.Fatalf("cap for OSLICEHEADER must be non-negative")
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:29:45 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  9. src/go/types/index.go

    		return
    	}
    
    	if x.mode != constant_ {
    		return x.typ, -1
    	}
    
    	if x.val.Kind() == constant.Unknown {
    		return
    	}
    
    	v, ok := constant.Int64Val(x.val)
    	assert(ok)
    	if max >= 0 && v >= max {
    		check.errorf(&x, InvalidIndex, invalidArg+"index %s out of bounds [0:%d]", x.val.String(), max)
    		return
    	}
    
    	// 0 <= v [ && v < max ]
    	return x.typ, v
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 22 16:17:05 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/types2/index.go

    		return
    	}
    
    	if x.mode != constant_ {
    		return x.typ, -1
    	}
    
    	if x.val.Kind() == constant.Unknown {
    		return
    	}
    
    	v, ok := constant.Int64Val(x.val)
    	assert(ok)
    	if max >= 0 && v >= max {
    		check.errorf(&x, InvalidIndex, invalidArg+"index %s out of bounds [0:%d]", x.val.String(), max)
    		return
    	}
    
    	// 0 <= v [ && v < max ]
    	return x.typ, v
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 15 16:16:58 UTC 2023
    - 11.5K bytes
    - Viewed (0)
Back to top