Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for IsUintptr (0.57 sec)

  1. test/sizeof.go

    type T struct {
    	X int
    }
    
    var t T
    
    func isUintptr(uintptr) {}
    
    type T2 struct {
    	A int32
    	U2
    }
    
    type U2 struct {
    	B int32
    	C int32
    }
    
    var t2 T2
    var p2 *T2
    
    func main() {
    	// Test unsafe.Sizeof, unsafe.Alignof, and unsafe.Offsetof all return uintptr.
    	isUintptr(unsafe.Sizeof(t))
    	isUintptr(unsafe.Alignof(t))
    	isUintptr(unsafe.Offsetof(t.X))
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 2.9K bytes
    - Viewed (0)
  2. src/go/types/conversions.go

    	}
    
    	// package unsafe:
    	// "any pointer or value of underlying type uintptr can be converted into a unsafe.Pointer"
    	if (isPointer(Vu) || isUintptr(Vu)) && isUnsafePointer(Tu) {
    		return true
    	}
    	// "and vice versa"
    	if isUnsafePointer(Vu) && (isPointer(Tu) || isUintptr(Tu)) {
    		return true
    	}
    
    	// "V is a slice, T is an array or pointer-to-array type,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 18:51:00 UTC 2024
    - 9.1K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/conversions.go

    	}
    
    	// package unsafe:
    	// "any pointer or value of underlying type uintptr can be converted into a unsafe.Pointer"
    	if (isPointer(Vu) || isUintptr(Vu)) && isUnsafePointer(Tu) {
    		return true
    	}
    	// "and vice versa"
    	if isUnsafePointer(Vu) && (isPointer(Tu) || isUintptr(Tu)) {
    		return true
    	}
    
    	// "V is a slice, T is an array or pointer-to-array type,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 18:51:00 UTC 2024
    - 9K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/ssa/check.go

    						f.Fatalf("nilcheck must have void type %s", v.Type.String())
    					}
    				} else {
    					if !v.Type.IsPtrShaped() && !v.Type.IsUintptr() {
    						f.Fatalf("nilcheck must have pointer type %s", v.Type.String())
    					}
    				}
    				if !v.Args[0].Type.IsPtrShaped() && !v.Args[0].Type.IsUintptr() {
    					f.Fatalf("nilcheck must have argument of pointer type %s", v.Args[0].Type.String())
    				}
    				if !v.Args[1].Type.IsMemory() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 09 16:41:23 UTC 2024
    - 17.6K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/typecheck/subr.go

    			return ir.OSTR2RUNES, ""
    		}
    	}
    
    	// 8. src is a pointer or uintptr and dst is unsafe.Pointer.
    	if (src.IsPtr() || src.IsUintptr()) && dst.IsUnsafePtr() {
    		return ir.OCONVNOP, ""
    	}
    
    	// 9. src is unsafe.Pointer and dst is a pointer or uintptr.
    	if src.IsUnsafePtr() && (dst.IsPtr() || dst.IsUintptr()) {
    		return ir.OCONVNOP, ""
    	}
    
    	// 10. src is a slice and dst is an array or pointer-to-array.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 05 19:45:58 UTC 2023
    - 20.2K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/typecheck/stmt.go

    			// like fixedbugs/issue24491a.go correctly.
    			//
    			// TODO(mdempsky): Limit to static callees with
    			// //go:uintptr{escapes,keepalive}?
    			if arg.Type().IsUintptr() && arg.X.Type().IsUnsafePtr() {
    				visit(&arg.X)
    				return
    			}
    
    		case ir.OARRAYLIT, ir.OSLICELIT, ir.OSTRUCTLIT:
    			// TODO(mdempsky): For very large slices, it may be preferable
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 20 15:10:54 UTC 2023
    - 17.8K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/walk/convert.go

    	n.X = walkExpr(n.X, init)
    	if n.Op() == ir.OCONVNOP && n.Type() == n.X.Type() {
    		return n.X
    	}
    	if n.Op() == ir.OCONVNOP && ir.ShouldCheckPtr(ir.CurFunc, 1) {
    		if n.Type().IsUnsafePtr() && n.X.Type().IsUintptr() { // uintptr to unsafe.Pointer
    			return walkCheckPtrArithmetic(n, init)
    		}
    	}
    	param, result := rtconvfn(n.X.Type(), n.Type())
    	if param == types.Txxx {
    		return n
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 17:28:22 UTC 2023
    - 18.2K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/types/type.go

    	return t.cache.ptr != nil
    }
    
    // IsUnsafePtr reports whether t is an unsafe pointer.
    func (t *Type) IsUnsafePtr() bool {
    	return t.kind == TUNSAFEPTR
    }
    
    // IsUintptr reports whether t is a uintptr.
    func (t *Type) IsUintptr() bool {
    	return t.kind == TUINTPTR
    }
    
    // IsPtrShaped reports whether t is represented by a single machine pointer.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:29:45 UTC 2024
    - 49.5K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/ssa/_gen/generic.rules

    (Load <t> (OffPtr [off]                       (Addr {s} sb)       ) _) && t.IsUintptr() && isFixedSym(s, off) => (Addr {fixedSym(b.Func, s, off)} sb)
    (Load <t> (OffPtr [off]              (Convert (Addr {s} sb) _)    ) _) && t.IsUintptr() && isFixedSym(s, off) => (Addr {fixedSym(b.Func, s, off)} sb)
    (Load <t> (OffPtr [off] (ITab (IMake          (Addr {s} sb)    _))) _) && t.IsUintptr() && isFixedSym(s, off) => (Addr {fixedSym(b.Func, s, off)} sb)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 22:21:05 UTC 2024
    - 135.3K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/ssa/rewritegeneric.go

    			break
    		}
    		s := auxToSym(v_0_0.Aux)
    		sb := v_0_0.Args[0]
    		if !(t.IsUintptr() && isFixedSym(s, off)) {
    			break
    		}
    		v.reset(OpAddr)
    		v.Aux = symToAux(fixedSym(b.Func, s, off))
    		v.AddArg(sb)
    		return true
    	}
    	// match: (Load <t> (OffPtr [off] (Convert (Addr {s} sb) _) ) _)
    	// cond: t.IsUintptr() && isFixedSym(s, off)
    	// result: (Addr {fixedSym(b.Func, s, off)} sb)
    	for {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 22 18:24:47 UTC 2024
    - 812.2K bytes
    - Viewed (0)
Back to top