- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 50 for slicedata (0.14 sec)
-
test/fixedbugs/issue57823.go
for i := 0; i < 10; i++ { runtime.GC() select { case <-done: return true default: } } return false } func slice() { s := make([]byte, 100) s[0] = 1 one := unsafe.SliceData(s) done := make(chan struct{}) runtime.SetFinalizer(one, func(*byte) { close(done) }) h := g(one) if wait(done) { panic("GC'd early") } if *h != 1 { panic("lost one") }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jan 18 01:27:21 UTC 2023 - 1.1K bytes - Viewed (0) -
src/unsafe/unsafe.go
func Slice(ptr *ArbitraryType, len IntegerType) []ArbitraryType // SliceData returns a pointer to the underlying array of the argument // slice. // - If cap(slice) > 0, SliceData returns &slice[:1][0]. // - If slice == nil, SliceData returns nil. // - Otherwise, SliceData returns a non-nil pointer to an // unspecified memory address. func SliceData(slice []ArbitraryType) *ArbitraryType
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 21 19:45:20 UTC 2024 - 12.1K bytes - Viewed (0) -
src/syscall/wtf8_windows_test.go
} }) } func FuzzDecodeWTF16(f *testing.F) { for _, tt := range wtf8tests { b := unsafe.Slice((*uint8)(unsafe.Pointer(unsafe.SliceData(tt.wstr))), len(tt.wstr)*2) f.Add(b) } f.Fuzz(func(t *testing.T, b []byte) { u16 := unsafe.Slice((*uint16)(unsafe.Pointer(unsafe.SliceData(b))), len(b)/2) got := syscall.DecodeWTF16(u16, nil) if utf8.Valid(got) { // if the input is a valid UTF-8 string, then
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 15 09:26:16 UTC 2023 - 4.3K bytes - Viewed (0) -
src/cmd/compile/internal/types2/builtins_test.go
{"Slice", `type B *byte; var b B; _ = unsafe.Slice(b, 0)`, `func(*byte, int) []byte`}, {"SliceData", "var s []int; _ = unsafe.SliceData(s)", `func([]int) *int`}, {"SliceData", "type S []int; var s S; _ = unsafe.SliceData(s)", `func([]int) *int`}, {"String", `var p *byte; _ = unsafe.String(p, 1)`, `func(*byte, int) string`},
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Feb 20 18:06:31 UTC 2024 - 10.8K bytes - Viewed (0) -
src/cmd/compile/internal/staticdata/data.go
// and then fix up length and content to use file. symdata = slicedata(pos, "") symdata.Size = size symdata.Type = objabi.SNOPTRDATA info := symdata.NewFileInfo() info.Name = file info.Size = size } return symdata, size, nil } var slicedataGen int func slicedata(pos src.XPos, s string) *obj.LSym { slicedataGen++
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 01 15:08:50 UTC 2023 - 10.3K bytes - Viewed (0) -
src/runtime/pprof/vminfo_darwin.go
} func regionFilename(address uint64) string { buf := make([]byte, _MAXPATHLEN) r := proc_regionfilename( os.Getpid(), address, unsafe.SliceData(buf), int64(cap(buf))) if r == 0 { return "" } return string(buf[:r]) } // mach_vm_region and proc_regionfilename are implemented by // the runtime package (runtime/sys_darwin.go). //
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Aug 04 23:35:39 UTC 2023 - 2K bytes - Viewed (0) -
src/internal/fuzz/mutator.go
byteSliceOverwriteConstantBytes, byteSliceShuffleBytes, byteSliceSwapBytes, } func (m *mutator) mutateBytes(ptrB *[]byte) { b := *ptrB defer func() { if unsafe.SliceData(*ptrB) != unsafe.SliceData(b) { panic("data moved to new address") } *ptrB = b }() for { mut := byteSliceMutators[m.rand(len(byteSliceMutators))] if mutated := mut(m, b); mutated != nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Sep 18 20:01:34 UTC 2023 - 6.6K bytes - Viewed (0) -
src/strings/compare_test.go
// unsafeString converts a []byte to a string with no allocation. // The caller must not modify b while the result string is in use. unsafeString := func(b []byte) string { return unsafe.String(unsafe.SliceData(b), len(b)) } lengths := make([]int, 0) // lengths to test in ascending order for i := 0; i <= 128; i++ { lengths = append(lengths, i) } lengths = append(lengths, 256, 512, 1024, 1333, 4095, 4096, 4097)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Sep 07 01:33:55 UTC 2022 - 2.8K bytes - Viewed (0) -
src/strings/builder.go
} else if b.addr != b { panic("strings: illegal use of non-zero Builder copied by value") } } // String returns the accumulated string. func (b *Builder) String() string { return unsafe.String(unsafe.SliceData(b.buf), len(b.buf)) } // Len returns the number of accumulated bytes; b.Len() == len(b.String()). func (b *Builder) Len() int { return len(b.buf) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Apr 17 21:09:59 UTC 2024 - 3.2K bytes - Viewed (0) -
staging/src/k8s.io/apiserver/pkg/authentication/token/cache/cached_token_authenticator.go
func toString(b []byte) string { // unsafe.SliceData relies on cap whereas we want to rely on len if len(b) == 0 { return "" } // Copied from go 1.20.1 strings.Builder.String // https://github.com/golang/go/blob/202a1a57064127c3f19d96df57b9f9586145e21c/src/strings/builder.go#L48 return unsafe.String(unsafe.SliceData(b), len(b)) } // simple recorder that only appends warning
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Mon Jul 03 16:16:51 UTC 2023 - 9.8K bytes - Viewed (0)