Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for SliceAt (0.09 sec)

  1. src/reflect/all_test.go

    	}
    
    	typ = TypeOf(0)
    	if !SliceAt(typ, unsafe.Pointer((*int)(nil)), 0).IsNil() {
    		t.Fatal("nil pointer with zero length must return nil")
    	}
    
    	// nil pointer with positive length panics
    	shouldPanic("", func() { _ = SliceAt(typ, unsafe.Pointer((*int)(nil)), 1) })
    
    	// negative length
    	var neg int = -1
    	shouldPanic("", func() { _ = SliceAt(TypeOf(byte(0)), unsafe.Pointer(&p[0]), neg) })
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 218.8K bytes
    - Viewed (0)
  2. src/reflect/value.go

    	return Value{&typ.(*rtype).t, unsafe.Pointer(&s), flagIndir | flag(Slice)}
    }
    
    // SliceAt returns a [Value] representing a slice whose underlying
    // data starts at p, with length and capacity equal to n.
    //
    // This is like [unsafe.Slice].
    func SliceAt(typ Type, p unsafe.Pointer, n int) Value {
    	unsafeslice(typ.common(), p, n)
    	s := unsafeheader.Slice{Data: p, Len: n, Cap: n}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 21:17:41 UTC 2024
    - 119.9K bytes
    - Viewed (0)
Back to top