Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for Alignof (0.16 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/cmd/internal/src/xpos_test.go

    	}
    
    	if tab.baseList[0] != nil || tab.indexMap[nil] != 0 {
    		t.Errorf("nil base not at index 0")
    	}
    }
    
    func TestSize(t *testing.T) {
    	var p XPos
    	if unsafe.Alignof(p) != 4 {
    		t.Errorf("alignment = %v; want 4", unsafe.Alignof(p))
    	}
    	if unsafe.Sizeof(p) != 8 {
    		t.Errorf("size = %v; want 8", unsafe.Sizeof(p))
    	}
    }
    
    func TestSetBase(t *testing.T) {
    	var tab PosTable
    	b1 := NewFileBase("b1", "b1")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 01 15:52:41 UTC 2023
    - 2.7K bytes
    - Viewed (0)
  7. test/fixedbugs/issue62515.go

    package main
    
    import "unsafe"
    
    func F[G int](g G) (uintptr, uintptr, uintptr) {
    	var c chan func() int
    	type s struct {
    		g G
    		x []int
    	}
    	return unsafe.Sizeof(s{g, make([]int, (<-c)())}),
    		unsafe.Alignof(s{g, make([]int, (<-c)())}),
    		unsafe.Offsetof(s{g, make([]int, (<-c)())}.x)
    }
    
    func main() {
    	F(0)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 11 20:48:07 UTC 2023
    - 592 bytes
    - Viewed (0)
  8. tensorflow/compiler/mlir/tfr/ir/tfr_types.h

        // Allocate a new storage instance.
        auto byteSize = TFRTypeStorage::totalSizeToAlloc<StringAttr>(key.size());
        auto rawMem = allocator.allocate(byteSize, alignof(TFRTypeStorage));
        auto result = ::new (rawMem) TFRTypeStorage(key.size());
    
        // Copy in the string attributes into the trailing storage.
        std::uninitialized_copy(key.begin(), key.end(),
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Tue Dec 05 07:17:01 UTC 2023
    - 4.1K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/types2/sizes_test.go

    		Importer: defaultImporter(),
    		Sizes:    &types2.StdSizes{WordSize: 8, MaxAlign: 8},
    	}
    	mustTypecheck(src, &conf, &info)
    	for _, tv := range info.Types {
    		_ = conf.Sizes.Sizeof(tv.Type)
    		_ = conf.Sizes.Alignof(tv.Type)
    	}
    }
    
    // go.dev/issue/53884.
    func TestAtomicAlign(t *testing.T) {
    	testenv.MustHaveGoBuild(t) // The Go command is needed for the importer to determine the locations of stdlib .a files.
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 16 21:00:48 UTC 2023
    - 4.1K bytes
    - Viewed (0)
  10. src/go/types/sizes_test.go

    		Importer: importer.Default(),
    		Sizes:    &types.StdSizes{WordSize: 8, MaxAlign: 8},
    	}
    	mustTypecheck(src, &conf, &info)
    	for _, tv := range info.Types {
    		_ = conf.Sizes.Sizeof(tv.Type)
    		_ = conf.Sizes.Alignof(tv.Type)
    	}
    }
    
    // go.dev/issue/53884.
    func TestAtomicAlign(t *testing.T) {
    	testenv.MustHaveGoBuild(t) // The Go command is needed for the importer to determine the locations of stdlib .a files.
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 16 21:00:48 UTC 2023
    - 4K bytes
    - Viewed (0)
Back to top