Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for Alignof (0.15 sec)

  1. src/go/types/gcsizes.go

    }
    
    func (s *gcSizes) Alignof(T Type) (result int64) {
    	defer func() {
    		assert(result >= 1)
    	}()
    
    	// For arrays and structs, alignment is defined in terms
    	// of alignment of the elements and fields, respectively.
    	switch t := under(T).(type) {
    	case *Array:
    		// spec: "For a variable x of array type: unsafe.Alignof(x)
    		// is the same as unsafe.Alignof(x[0]), but at least 1."
    		return s.Alignof(t.elem)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/types2/sizes.go

    }
    
    // stdSizes is used if Config.Sizes == nil.
    var stdSizes = SizesFor("gc", "amd64")
    
    func (conf *Config) alignof(T Type) int64 {
    	f := stdSizes.Alignof
    	if conf.Sizes != nil {
    		f = conf.Sizes.Alignof
    	}
    	if a := f(T); a >= 1 {
    		return a
    	}
    	panic("implementation of alignof returned an alignment < 1")
    }
    
    func (conf *Config) offsetsof(T *Struct) []int64 {
    	var offsets []int64
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 8.8K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/gcsizes.go

    }
    
    func (s *gcSizes) Alignof(T Type) (result int64) {
    	defer func() {
    		assert(result >= 1)
    	}()
    
    	// For arrays and structs, alignment is defined in terms
    	// of alignment of the elements and fields, respectively.
    	switch t := under(T).(type) {
    	case *Array:
    		// spec: "For a variable x of array type: unsafe.Alignof(x)
    		// is the same as unsafe.Alignof(x[0]), but at least 1."
    		return s.Alignof(t.elem)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  4. src/go/types/sizes.go

    }
    
    // stdSizes is used if Config.Sizes == nil.
    var stdSizes = SizesFor("gc", "amd64")
    
    func (conf *Config) alignof(T Type) int64 {
    	f := stdSizes.Alignof
    	if conf.Sizes != nil {
    		f = conf.Sizes.Alignof
    	}
    	if a := f(T); a >= 1 {
    		return a
    	}
    	panic("implementation of alignof returned an alignment < 1")
    }
    
    func (conf *Config) offsetsof(T *Struct) []int64 {
    	var offsets []int64
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  5. src/internal/abi/compiletype.go

    // Their contents must be kept in sync with their definitions.
    // Because the host and target type sizes can differ, the compiler and
    // linker cannot use the host information that they might get from
    // either unsafe.Sizeof and Alignof, nor runtime, reflect, or reflectlite.
    
    // CommonSize returns sizeof(Type) for a compilation target with a given ptrSize
    func CommonSize(ptrSize int) int { return 4*ptrSize + 8 + 8 }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 03:01:24 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  6. src/internal/types/testdata/check/builtins0.go

    	unsafe /* ERROR "not used" */ .Alignof(x)
    
    	var y S0
    	assert(unsafe.Alignof(y.a) == 1)
    	assert(unsafe.Alignof(y.b) == 4)
    	assert(unsafe.Alignof(y.c) == 8)
    	assert(unsafe.Alignof(y.d) == 1)
    	assert(unsafe.Alignof(y.e) == 8)
    
    	var s []byte
    	_ = unsafe.Alignof(s)
    	_ = unsafe.Alignof(s... /* ERROR "invalid use of ..." */ )
    }
    
    func Alignof2() {
    	f1 := func() (x int32) { return }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 29.3K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/builtins_test.go

    	{"Add", `_ = unsafe.Add(nil, 0)`, `func(unsafe.Pointer, int) unsafe.Pointer`},
    
    	{"Alignof", `_ = unsafe.Alignof(0)`, `invalid type`},                 // constant
    	{"Alignof", `var x struct{}; _ = unsafe.Alignof(x)`, `invalid type`}, // constant
    	{"Alignof", `var x P; _ = unsafe.Alignof(x)`, `func(P) uintptr`},
    
    	{"Offsetof", `var x struct{f bool}; _ = unsafe.Offsetof(x.f)`, `invalid type`},           // constant
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 20 18:06:31 UTC 2024
    - 10.8K bytes
    - Viewed (0)
  8. src/go/types/builtins_test.go

    	{"Add", `_ = unsafe.Add(nil, 0)`, `func(unsafe.Pointer, int) unsafe.Pointer`},
    
    	{"Alignof", `_ = unsafe.Alignof(0)`, `invalid type`},                 // constant
    	{"Alignof", `var x struct{}; _ = unsafe.Alignof(x)`, `invalid type`}, // constant
    	{"Alignof", `var x P; _ = unsafe.Alignof(x)`, `func(P) uintptr`},
    
    	{"Offsetof", `var x struct{f bool}; _ = unsafe.Offsetof(x.f)`, `invalid type`},           // constant
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 10.9K bytes
    - Viewed (0)
  9. src/unsafe/unsafe.go

    // As a special case, if a variable s is of struct type and f is a field
    // within that struct, then Alignof(s.f) will return the required alignment
    // of a field of that type within a struct. This case is the same as the
    // value returned by [reflect.TypeOf](s.f).FieldAlign().
    // The return value of Alignof is a Go constant if the type of the argument
    // does not have variable size.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 21 19:45:20 UTC 2024
    - 12.1K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/types2/universe.go

    	_Println: {"println", 0, true, statement},
    	_Real:    {"real", 1, false, expression},
    	_Recover: {"recover", 0, false, statement},
    
    	_Add:        {"Add", 2, false, expression},
    	_Alignof:    {"Alignof", 1, false, expression},
    	_Offsetof:   {"Offsetof", 1, false, expression},
    	_Sizeof:     {"Sizeof", 1, false, expression},
    	_Slice:      {"Slice", 2, false, expression},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 20:08:23 UTC 2024
    - 9.1K bytes
    - Viewed (0)
Back to top