Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,781 for unsafe (0.14 sec)

  1. src/runtime/unsafe.go

    	if checkptrStraddles(ptr, uintptr(len64)) {
    		throw("checkptr: unsafe.String result straddles multiple allocations")
    	}
    }
    
    func panicunsafestringlen() {
    	panic(errorString("unsafe.String: len out of range"))
    }
    
    func panicunsafestringnilptr() {
    	panic(errorString("unsafe.String: ptr is nil and len is not zero"))
    }
    
    // Keep this code in sync with cmd/compile/internal/walk/builtin.go:walkUnsafeSlice
    Registered: 2024-06-12 16:32
    - Last Modified: 2024-04-02 21:51
    - 3.1K bytes
    - Viewed (0)
  2. src/unsafe/unsafe.go

    //
    //	p = unsafe.Pointer(uintptr(p) + offset)
    //
    // The most common use of this pattern is to access fields in a struct
    // or elements of an array:
    //
    //	// equivalent to f := unsafe.Pointer(&s.f)
    //	f := unsafe.Pointer(uintptr(unsafe.Pointer(&s)) + unsafe.Offsetof(s.f))
    //
    //	// equivalent to e := unsafe.Pointer(&x[i])
    //	e := unsafe.Pointer(uintptr(unsafe.Pointer(&x[0])) + i*unsafe.Sizeof(x[0]))
    //
    Registered: 2024-06-12 16:32
    - Last Modified: 2024-05-21 19:45
    - 12.1K bytes
    - Viewed (0)
  3. src/math/unsafe.go

    func Float32bits(f float32) uint32 { return *(*uint32)(unsafe.Pointer(&f)) }
    
    // Float32frombits returns the floating-point number corresponding
    // to the IEEE 754 binary representation b, with the sign bit of b
    // and the result in the same bit position.
    // Float32frombits(Float32bits(x)) == x.
    func Float32frombits(b uint32) float32 { return *(*float32)(unsafe.Pointer(&b)) }
    
    Registered: 2024-06-12 16:32
    - Last Modified: 2024-05-29 17:58
    - 1.6K bytes
    - Viewed (0)
  4. src/runtime/testdata/testprog/unsafe.go

    package main
    
    import "unsafe"
    
    func init() {
    	register("panicOnNilAndEleSizeIsZero", panicOnNilAndEleSizeIsZero)
    }
    
    func panicOnNilAndEleSizeIsZero() {
    	var p *struct{}
    	_ = unsafe.Slice(p, 5)
    Registered: 2024-06-12 16:32
    - Last Modified: 2022-08-12 15:45
    - 195 bytes
    - Viewed (0)
  5. src/runtime/align_runtime_test.go

    	unsafe.Offsetof(heapStatsDelta{}.smallFreeCount),
    	unsafe.Offsetof(heapStatsDelta{}.largeAlloc),
    	unsafe.Offsetof(heapStatsDelta{}.largeAllocCount),
    	unsafe.Offsetof(heapStatsDelta{}.largeFree),
    	unsafe.Offsetof(heapStatsDelta{}.largeFreeCount),
    	unsafe.Offsetof(heapStatsDelta{}.committed),
    	unsafe.Offsetof(heapStatsDelta{}.released),
    	unsafe.Offsetof(heapStatsDelta{}.inHeap),
    	unsafe.Offsetof(heapStatsDelta{}.inStacks),
    Registered: 2024-06-12 16:32
    - Last Modified: 2024-03-25 19:53
    - 1.8K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/ssa/allocators.go

    	var base *Value
    	var derived *Block
    	if unsafe.Sizeof(base)%unsafe.Sizeof(derived) != 0 {
    		panic("bad")
    	}
    	scale := unsafe.Sizeof(base) / unsafe.Sizeof(derived)
    	b := c.allocValueSlice(int((uintptr(n) + scale - 1) / scale))
    	s := unsafeheader.Slice{
    		Data: unsafe.Pointer(&b[0]),
    		Len:  n,
    		Cap:  cap(b) * int(scale),
    	}
    	return *(*[]*Block)(unsafe.Pointer(&s))
    }
    Registered: 2024-06-12 16:32
    - Last Modified: 2023-02-15 23:00
    - 7.4K bytes
    - Viewed (0)
  7. src/runtime/syscall_solaris.go

    	call := libcall{
    		fn:   uintptr(unsafe.Pointer(&libc_setgroups)),
    		n:    2,
    		args: uintptr(unsafe.Pointer(&ngid)),
    	}
    	asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
    	return call.err
    }
    
    //go:nosplit
    //go:linkname syscall_setrlimit
    //go:cgo_unsafe_args
    func syscall_setrlimit(which uintptr, lim unsafe.Pointer) (err uintptr) {
    	call := libcall{
    		fn:   uintptr(unsafe.Pointer(&libc_setrlimit)),
    Registered: 2024-06-12 16:32
    - Last Modified: 2023-06-06 18:49
    - 8.4K bytes
    - Viewed (0)
  8. src/syscall/zsyscall_windows.go

    	if r0 != 0 {
    Registered: 2024-06-12 16:32
    - Last Modified: 2024-03-21 11:49
    - 56.3K bytes
    - Viewed (1)
  9. test/unsafebuiltins.go

    package main
    
    import (
    	"math"
    	"unsafe"
    )
    
    const maxUintptr = 1 << (8 * unsafe.Sizeof(uintptr(0)))
    
    func main() {
    	var p [10]byte
    
    	// unsafe.Add
    	{
    		p1 := unsafe.Pointer(&p[1])
    		assert(unsafe.Add(p1, 1) == unsafe.Pointer(&p[2]))
    		assert(unsafe.Add(p1, -1) == unsafe.Pointer(&p[0]))
    	}
    
    	// unsafe.Slice
    	{
    		s := unsafe.Slice(&p[0], len(p))
    		assert(&s[0] == &p[0])
    Registered: 2024-06-12 16:32
    - Last Modified: 2022-08-31 17:15
    - 2.3K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/sys/unix/bpxsvc_zos.go

    )
    
    func Bpx4ptr(request int32, pid int32, addr unsafe.Pointer, data unsafe.Pointer, buffer unsafe.Pointer) (rv int32, rc int32, rn int32) {
    	var parms [8]unsafe.Pointer
    	parms[0] = unsafe.Pointer(&request)
    	parms[1] = unsafe.Pointer(&pid)
    	parms[2] = unsafe.Pointer(&addr)
    	parms[3] = unsafe.Pointer(&data)
    	parms[4] = unsafe.Pointer(&buffer)
    	parms[5] = unsafe.Pointer(&rv)
    	parms[6] = unsafe.Pointer(&rc)
    	parms[7] = unsafe.Pointer(&rn)
    Registered: 2024-06-12 16:32
    - Last Modified: 2024-05-08 16:12
    - 19.9K bytes
    - Viewed (0)
Back to top