update vendor
This commit is contained in:
parent
824f46979b
commit
8675bc4b7a
328 changed files with 27166 additions and 6537 deletions
59
vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
generated
vendored
59
vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
generated
vendored
|
|
@ -2,15 +2,14 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !purego && !appengine
|
||||
// +build !purego,!appengine
|
||||
|
||||
package impl
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
|
||||
"google.golang.org/protobuf/internal/protolazy"
|
||||
)
|
||||
|
||||
const UnsafeEnabled = true
|
||||
|
|
@ -23,7 +22,7 @@ type Pointer unsafe.Pointer
|
|||
type offset uintptr
|
||||
|
||||
// offsetOf returns a field offset for the struct field.
|
||||
func offsetOf(f reflect.StructField, x exporter) offset {
|
||||
func offsetOf(f reflect.StructField) offset {
|
||||
return offset(f.Offset)
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +49,7 @@ func pointerOfValue(v reflect.Value) pointer {
|
|||
}
|
||||
|
||||
// pointerOfIface returns the pointer portion of an interface.
|
||||
func pointerOfIface(v interface{}) pointer {
|
||||
func pointerOfIface(v any) pointer {
|
||||
type ifaceHeader struct {
|
||||
Type unsafe.Pointer
|
||||
Data unsafe.Pointer
|
||||
|
|
@ -80,7 +79,7 @@ func (p pointer) AsValueOf(t reflect.Type) reflect.Value {
|
|||
|
||||
// AsIfaceOf treats p as a pointer to an object of type t and returns the value.
|
||||
// It is equivalent to p.AsValueOf(t).Interface()
|
||||
func (p pointer) AsIfaceOf(t reflect.Type) interface{} {
|
||||
func (p pointer) AsIfaceOf(t reflect.Type) any {
|
||||
// TODO: Use tricky unsafe magic to directly create ifaceHeader.
|
||||
return p.AsValueOf(t).Interface()
|
||||
}
|
||||
|
|
@ -112,8 +111,14 @@ func (p pointer) StringSlice() *[]string { return (*[]string)(p.p
|
|||
func (p pointer) Bytes() *[]byte { return (*[]byte)(p.p) }
|
||||
func (p pointer) BytesPtr() **[]byte { return (**[]byte)(p.p) }
|
||||
func (p pointer) BytesSlice() *[][]byte { return (*[][]byte)(p.p) }
|
||||
func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.p) }
|
||||
func (p pointer) Extensions() *map[int32]ExtensionField { return (*map[int32]ExtensionField)(p.p) }
|
||||
func (p pointer) LazyInfoPtr() **protolazy.XXX_lazyUnmarshalInfo {
|
||||
return (**protolazy.XXX_lazyUnmarshalInfo)(p.p)
|
||||
}
|
||||
|
||||
func (p pointer) PresenceInfo() presence {
|
||||
return presence{P: p.p}
|
||||
}
|
||||
|
||||
func (p pointer) Elem() pointer {
|
||||
return pointer{p: *(*unsafe.Pointer)(p.p)}
|
||||
|
|
@ -138,6 +143,46 @@ func (p pointer) SetPointer(v pointer) {
|
|||
*(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p)
|
||||
}
|
||||
|
||||
func (p pointer) growBoolSlice(addCap int) {
|
||||
sp := p.BoolSlice()
|
||||
s := make([]bool, 0, addCap+len(*sp))
|
||||
s = s[:len(*sp)]
|
||||
copy(s, *sp)
|
||||
*sp = s
|
||||
}
|
||||
|
||||
func (p pointer) growInt32Slice(addCap int) {
|
||||
sp := p.Int32Slice()
|
||||
s := make([]int32, 0, addCap+len(*sp))
|
||||
s = s[:len(*sp)]
|
||||
copy(s, *sp)
|
||||
*sp = s
|
||||
}
|
||||
|
||||
func (p pointer) growUint32Slice(addCap int) {
|
||||
p.growInt32Slice(addCap)
|
||||
}
|
||||
|
||||
func (p pointer) growFloat32Slice(addCap int) {
|
||||
p.growInt32Slice(addCap)
|
||||
}
|
||||
|
||||
func (p pointer) growInt64Slice(addCap int) {
|
||||
sp := p.Int64Slice()
|
||||
s := make([]int64, 0, addCap+len(*sp))
|
||||
s = s[:len(*sp)]
|
||||
copy(s, *sp)
|
||||
*sp = s
|
||||
}
|
||||
|
||||
func (p pointer) growUint64Slice(addCap int) {
|
||||
p.growInt64Slice(addCap)
|
||||
}
|
||||
|
||||
func (p pointer) growFloat64Slice(addCap int) {
|
||||
p.growInt64Slice(addCap)
|
||||
}
|
||||
|
||||
// Static check that MessageState does not exceed the size of a pointer.
|
||||
const _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{}))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue