internal/impl: add fast-path marshal implementation
This is a port of the v1 table marshaler, with some substantial
cleanup and refactoring.
Benchstat results from the protobuf reference benchmark data comparing the
v1 package with v2, with AllowPartial:true set for the new package. This
is not an apples-to-apples comparison, since v1 doesn't have a way to
disable required field checks. Required field checks in v2 package
currently go through reflection, which performs terribly; my initial
experimentation indicates that fast-path required field checks will
not add a large amount of cost; these results are incomplete but not
wholly inaccurate.
name old time/op new time/op delta
/dataset.google_message3_1.pb/Marshal-12 219ms ± 1% 232ms ± 1% +5.85% (p=0.004 n=6+5)
/dataset.google_message2.pb/Marshal-12 261µs ± 3% 248µs ± 1% -5.14% (p=0.002 n=6+6)
/dataset.google_message1_proto2.pb/Marshal-12 681ns ± 2% 637ns ± 3% -6.53% (p=0.002 n=6+6)
/dataset.google_message1_proto3.pb/Marshal-12 1.10µs ± 8% 0.99µs ± 3% -9.63% (p=0.002 n=6+6)
/dataset.google_message3_3.pb/Marshal-12 44.2ms ± 3% 35.2ms ± 1% -20.28% (p=0.004 n=6+5)
/dataset.google_message4.pb/Marshal-12 91.4ms ± 2% 94.9ms ± 2% +3.78% (p=0.002 n=6+6)
/dataset.google_message3_2.pb/Marshal-12 78.7ms ± 6% 80.8ms ± 4% ~ (p=0.310 n=6+6)
/dataset.google_message3_4.pb/Marshal-12 10.6ms ± 3% 10.6ms ± 8% ~ (p=0.662 n=5+6)
/dataset.google_message3_5.pb/Marshal-12 675ms ± 4% 510ms ± 2% -24.40% (p=0.002 n=6+6)
/dataset.google_message3_1.pb/Marshal 219ms ± 1% 236ms ± 7% +8.06% (p=0.004 n=5+6)
/dataset.google_message2.pb/Marshal 257µs ± 1% 250µs ± 3% ~ (p=0.052 n=5+6)
/dataset.google_message1_proto2.pb/Marshal 685ns ± 1% 628ns ± 1% -8.41% (p=0.008 n=5+5)
/dataset.google_message1_proto3.pb/Marshal 1.08µs ± 1% 0.98µs ± 2% -9.31% (p=0.004 n=5+6)
/dataset.google_message3_3.pb/Marshal 43.7ms ± 1% 35.1ms ± 1% -19.76% (p=0.002 n=6+6)
/dataset.google_message4.pb/Marshal 93.4ms ± 4% 94.9ms ± 2% ~ (p=0.180 n=6+6)
/dataset.google_message3_2.pb/Marshal 105ms ± 2% 98ms ± 7% -6.81% (p=0.009 n=5+6)
/dataset.google_message3_4.pb/Marshal 16.3ms ± 6% 15.7ms ± 3% -3.44% (p=0.041 n=6+6)
/dataset.google_message3_5.pb/Marshal 676ms ± 4% 504ms ± 2% -25.50% (p=0.004 n=6+5)
Change-Id: I72cc4597117f4cf5d236ef505777d49dd4a5f75d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/171020
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/internal/impl/encode_gen.go b/internal/impl/encode_gen.go
new file mode 100644
index 0000000..6f55323
--- /dev/null
+++ b/internal/impl/encode_gen.go
@@ -0,0 +1,2420 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style.
+// license that can be found in the LICENSE file.
+
+// Code generated by generate-types. DO NOT EDIT.
+
+package impl
+
+import (
+ "math"
+
+ "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/reflect/protoreflect"
+)
+
+// sizeBool returns the size of wire encoding a bool pointer as a Bool.
+func sizeBool(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Bool()
+ return tagsize + wire.SizeVarint(wire.EncodeBool(v))
+}
+
+// appendBool wire encodes a bool pointer as a Bool.
+func appendBool(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Bool()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeBool(v))
+ return b, nil
+}
+
+var coderBool = pointerCoderFuncs{
+ size: sizeBool,
+ marshal: appendBool,
+}
+
+// sizeBool returns the size of wire encoding a bool pointer as a Bool.
+// The zero value is not encoded.
+func sizeBoolNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Bool()
+ if v == false {
+ return 0
+ }
+ return tagsize + wire.SizeVarint(wire.EncodeBool(v))
+}
+
+// appendBool wire encodes a bool pointer as a Bool.
+// The zero value is not encoded.
+func appendBoolNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Bool()
+ if v == false {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeBool(v))
+ return b, nil
+}
+
+var coderBoolNoZero = pointerCoderFuncs{
+ size: sizeBoolNoZero,
+ marshal: appendBoolNoZero,
+}
+
+// sizeBoolPtr returns the size of wire encoding a *bool pointer as a Bool.
+// It panics if the pointer is nil.
+func sizeBoolPtr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := **p.BoolPtr()
+ return tagsize + wire.SizeVarint(wire.EncodeBool(v))
+}
+
+// appendBool wire encodes a *bool pointer as a Bool.
+// It panics if the pointer is nil.
+func appendBoolPtr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.BoolPtr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeBool(v))
+ return b, nil
+}
+
+var coderBoolPtr = pointerCoderFuncs{
+ size: sizeBoolPtr,
+ marshal: appendBoolPtr,
+}
+
+// sizeBoolSlice returns the size of wire encoding a []bool pointer as a repeated Bool.
+func sizeBoolSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.BoolSlice()
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(wire.EncodeBool(v))
+ }
+ return size
+}
+
+// appendBoolSlice encodes a []bool pointer as a repeated Bool.
+func appendBoolSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.BoolSlice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeBool(v))
+ }
+ return b, nil
+}
+
+var coderBoolSlice = pointerCoderFuncs{
+ size: sizeBoolSlice,
+ marshal: appendBoolSlice,
+}
+
+// sizeBoolPackedSlice returns the size of wire encoding a []bool pointer as a packed repeated Bool.
+func sizeBoolPackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.BoolSlice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(wire.EncodeBool(v))
+ }
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool.
+func appendBoolPackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.BoolSlice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(wire.EncodeBool(v))
+ }
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendVarint(b, wire.EncodeBool(v))
+ }
+ return b, nil
+}
+
+var coderBoolPackedSlice = pointerCoderFuncs{
+ size: sizeBoolPackedSlice,
+ marshal: appendBoolPackedSlice,
+}
+
+// sizeBoolIface returns the size of wire encoding a bool value as a Bool.
+func sizeBoolIface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.(bool)
+ return tagsize + wire.SizeVarint(wire.EncodeBool(v))
+}
+
+// appendBoolIface encodes a bool value as a Bool.
+func appendBoolIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(bool)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeBool(v))
+ return b, nil
+}
+
+var coderBoolIface = ifaceCoderFuncs{
+ size: sizeBoolIface,
+ marshal: appendBoolIface,
+}
+
+// sizeBoolSliceIface returns the size of wire encoding a []bool value as a repeated Bool.
+func sizeBoolSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]bool)
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(wire.EncodeBool(v))
+ }
+ return size
+}
+
+// appendBoolSliceIface encodes a []bool value as a repeated Bool.
+func appendBoolSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]bool)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeBool(v))
+ }
+ return b, nil
+}
+
+var coderBoolSliceIface = ifaceCoderFuncs{
+ size: sizeBoolSliceIface,
+ marshal: appendBoolSliceIface,
+}
+
+// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.
+func sizeInt32(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int32()
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendInt32 wire encodes a int32 pointer as a Int32.
+func appendInt32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int32()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderInt32 = pointerCoderFuncs{
+ size: sizeInt32,
+ marshal: appendInt32,
+}
+
+// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.
+// The zero value is not encoded.
+func sizeInt32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int32()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendInt32 wire encodes a int32 pointer as a Int32.
+// The zero value is not encoded.
+func appendInt32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int32()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderInt32NoZero = pointerCoderFuncs{
+ size: sizeInt32NoZero,
+ marshal: appendInt32NoZero,
+}
+
+// sizeInt32Ptr returns the size of wire encoding a *int32 pointer as a Int32.
+// It panics if the pointer is nil.
+func sizeInt32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := **p.Int32Ptr()
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendInt32 wire encodes a *int32 pointer as a Int32.
+// It panics if the pointer is nil.
+func appendInt32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Int32Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderInt32Ptr = pointerCoderFuncs{
+ size: sizeInt32Ptr,
+ marshal: appendInt32Ptr,
+}
+
+// sizeInt32Slice returns the size of wire encoding a []int32 pointer as a repeated Int32.
+func sizeInt32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int32Slice()
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(uint64(v))
+ }
+ return size
+}
+
+// appendInt32Slice encodes a []int32 pointer as a repeated Int32.
+func appendInt32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int32Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderInt32Slice = pointerCoderFuncs{
+ size: sizeInt32Slice,
+ marshal: appendInt32Slice,
+}
+
+// sizeInt32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Int32.
+func sizeInt32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int32Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(uint64(v))
+ }
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32.
+func appendInt32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int32Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(uint64(v))
+ }
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderInt32PackedSlice = pointerCoderFuncs{
+ size: sizeInt32PackedSlice,
+ marshal: appendInt32PackedSlice,
+}
+
+// sizeInt32Iface returns the size of wire encoding a int32 value as a Int32.
+func sizeInt32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.(int32)
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendInt32Iface encodes a int32 value as a Int32.
+func appendInt32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(int32)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderInt32Iface = ifaceCoderFuncs{
+ size: sizeInt32Iface,
+ marshal: appendInt32Iface,
+}
+
+// sizeInt32SliceIface returns the size of wire encoding a []int32 value as a repeated Int32.
+func sizeInt32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]int32)
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(uint64(v))
+ }
+ return size
+}
+
+// appendInt32SliceIface encodes a []int32 value as a repeated Int32.
+func appendInt32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]int32)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderInt32SliceIface = ifaceCoderFuncs{
+ size: sizeInt32SliceIface,
+ marshal: appendInt32SliceIface,
+}
+
+// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.
+func sizeSint32(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int32()
+ return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+}
+
+// appendSint32 wire encodes a int32 pointer as a Sint32.
+func appendSint32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int32()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ return b, nil
+}
+
+var coderSint32 = pointerCoderFuncs{
+ size: sizeSint32,
+ marshal: appendSint32,
+}
+
+// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.
+// The zero value is not encoded.
+func sizeSint32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int32()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+}
+
+// appendSint32 wire encodes a int32 pointer as a Sint32.
+// The zero value is not encoded.
+func appendSint32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int32()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ return b, nil
+}
+
+var coderSint32NoZero = pointerCoderFuncs{
+ size: sizeSint32NoZero,
+ marshal: appendSint32NoZero,
+}
+
+// sizeSint32Ptr returns the size of wire encoding a *int32 pointer as a Sint32.
+// It panics if the pointer is nil.
+func sizeSint32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := **p.Int32Ptr()
+ return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+}
+
+// appendSint32 wire encodes a *int32 pointer as a Sint32.
+// It panics if the pointer is nil.
+func appendSint32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Int32Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ return b, nil
+}
+
+var coderSint32Ptr = pointerCoderFuncs{
+ size: sizeSint32Ptr,
+ marshal: appendSint32Ptr,
+}
+
+// sizeSint32Slice returns the size of wire encoding a []int32 pointer as a repeated Sint32.
+func sizeSint32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int32Slice()
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ }
+ return size
+}
+
+// appendSint32Slice encodes a []int32 pointer as a repeated Sint32.
+func appendSint32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int32Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ }
+ return b, nil
+}
+
+var coderSint32Slice = pointerCoderFuncs{
+ size: sizeSint32Slice,
+ marshal: appendSint32Slice,
+}
+
+// sizeSint32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sint32.
+func sizeSint32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int32Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ }
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32.
+func appendSint32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int32Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ }
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ }
+ return b, nil
+}
+
+var coderSint32PackedSlice = pointerCoderFuncs{
+ size: sizeSint32PackedSlice,
+ marshal: appendSint32PackedSlice,
+}
+
+// sizeSint32Iface returns the size of wire encoding a int32 value as a Sint32.
+func sizeSint32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.(int32)
+ return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+}
+
+// appendSint32Iface encodes a int32 value as a Sint32.
+func appendSint32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(int32)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ return b, nil
+}
+
+var coderSint32Iface = ifaceCoderFuncs{
+ size: sizeSint32Iface,
+ marshal: appendSint32Iface,
+}
+
+// sizeSint32SliceIface returns the size of wire encoding a []int32 value as a repeated Sint32.
+func sizeSint32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]int32)
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ }
+ return size
+}
+
+// appendSint32SliceIface encodes a []int32 value as a repeated Sint32.
+func appendSint32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]int32)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ }
+ return b, nil
+}
+
+var coderSint32SliceIface = ifaceCoderFuncs{
+ size: sizeSint32SliceIface,
+ marshal: appendSint32SliceIface,
+}
+
+// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.
+func sizeUint32(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Uint32()
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendUint32 wire encodes a uint32 pointer as a Uint32.
+func appendUint32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Uint32()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderUint32 = pointerCoderFuncs{
+ size: sizeUint32,
+ marshal: appendUint32,
+}
+
+// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.
+// The zero value is not encoded.
+func sizeUint32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Uint32()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendUint32 wire encodes a uint32 pointer as a Uint32.
+// The zero value is not encoded.
+func appendUint32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Uint32()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderUint32NoZero = pointerCoderFuncs{
+ size: sizeUint32NoZero,
+ marshal: appendUint32NoZero,
+}
+
+// sizeUint32Ptr returns the size of wire encoding a *uint32 pointer as a Uint32.
+// It panics if the pointer is nil.
+func sizeUint32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := **p.Uint32Ptr()
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendUint32 wire encodes a *uint32 pointer as a Uint32.
+// It panics if the pointer is nil.
+func appendUint32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Uint32Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderUint32Ptr = pointerCoderFuncs{
+ size: sizeUint32Ptr,
+ marshal: appendUint32Ptr,
+}
+
+// sizeUint32Slice returns the size of wire encoding a []uint32 pointer as a repeated Uint32.
+func sizeUint32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Uint32Slice()
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(uint64(v))
+ }
+ return size
+}
+
+// appendUint32Slice encodes a []uint32 pointer as a repeated Uint32.
+func appendUint32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Uint32Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderUint32Slice = pointerCoderFuncs{
+ size: sizeUint32Slice,
+ marshal: appendUint32Slice,
+}
+
+// sizeUint32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Uint32.
+func sizeUint32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Uint32Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(uint64(v))
+ }
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32.
+func appendUint32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Uint32Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(uint64(v))
+ }
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderUint32PackedSlice = pointerCoderFuncs{
+ size: sizeUint32PackedSlice,
+ marshal: appendUint32PackedSlice,
+}
+
+// sizeUint32Iface returns the size of wire encoding a uint32 value as a Uint32.
+func sizeUint32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.(uint32)
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendUint32Iface encodes a uint32 value as a Uint32.
+func appendUint32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(uint32)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderUint32Iface = ifaceCoderFuncs{
+ size: sizeUint32Iface,
+ marshal: appendUint32Iface,
+}
+
+// sizeUint32SliceIface returns the size of wire encoding a []uint32 value as a repeated Uint32.
+func sizeUint32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]uint32)
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(uint64(v))
+ }
+ return size
+}
+
+// appendUint32SliceIface encodes a []uint32 value as a repeated Uint32.
+func appendUint32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]uint32)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderUint32SliceIface = ifaceCoderFuncs{
+ size: sizeUint32SliceIface,
+ marshal: appendUint32SliceIface,
+}
+
+// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.
+func sizeInt64(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int64()
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendInt64 wire encodes a int64 pointer as a Int64.
+func appendInt64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int64()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderInt64 = pointerCoderFuncs{
+ size: sizeInt64,
+ marshal: appendInt64,
+}
+
+// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.
+// The zero value is not encoded.
+func sizeInt64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int64()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendInt64 wire encodes a int64 pointer as a Int64.
+// The zero value is not encoded.
+func appendInt64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int64()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderInt64NoZero = pointerCoderFuncs{
+ size: sizeInt64NoZero,
+ marshal: appendInt64NoZero,
+}
+
+// sizeInt64Ptr returns the size of wire encoding a *int64 pointer as a Int64.
+// It panics if the pointer is nil.
+func sizeInt64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := **p.Int64Ptr()
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendInt64 wire encodes a *int64 pointer as a Int64.
+// It panics if the pointer is nil.
+func appendInt64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Int64Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderInt64Ptr = pointerCoderFuncs{
+ size: sizeInt64Ptr,
+ marshal: appendInt64Ptr,
+}
+
+// sizeInt64Slice returns the size of wire encoding a []int64 pointer as a repeated Int64.
+func sizeInt64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int64Slice()
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(uint64(v))
+ }
+ return size
+}
+
+// appendInt64Slice encodes a []int64 pointer as a repeated Int64.
+func appendInt64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int64Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderInt64Slice = pointerCoderFuncs{
+ size: sizeInt64Slice,
+ marshal: appendInt64Slice,
+}
+
+// sizeInt64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Int64.
+func sizeInt64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int64Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(uint64(v))
+ }
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64.
+func appendInt64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int64Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(uint64(v))
+ }
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderInt64PackedSlice = pointerCoderFuncs{
+ size: sizeInt64PackedSlice,
+ marshal: appendInt64PackedSlice,
+}
+
+// sizeInt64Iface returns the size of wire encoding a int64 value as a Int64.
+func sizeInt64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.(int64)
+ return tagsize + wire.SizeVarint(uint64(v))
+}
+
+// appendInt64Iface encodes a int64 value as a Int64.
+func appendInt64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(int64)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ return b, nil
+}
+
+var coderInt64Iface = ifaceCoderFuncs{
+ size: sizeInt64Iface,
+ marshal: appendInt64Iface,
+}
+
+// sizeInt64SliceIface returns the size of wire encoding a []int64 value as a repeated Int64.
+func sizeInt64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]int64)
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(uint64(v))
+ }
+ return size
+}
+
+// appendInt64SliceIface encodes a []int64 value as a repeated Int64.
+func appendInt64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]int64)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderInt64SliceIface = ifaceCoderFuncs{
+ size: sizeInt64SliceIface,
+ marshal: appendInt64SliceIface,
+}
+
+// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.
+func sizeSint64(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int64()
+ return tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+}
+
+// appendSint64 wire encodes a int64 pointer as a Sint64.
+func appendSint64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int64()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ return b, nil
+}
+
+var coderSint64 = pointerCoderFuncs{
+ size: sizeSint64,
+ marshal: appendSint64,
+}
+
+// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.
+// The zero value is not encoded.
+func sizeSint64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int64()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+}
+
+// appendSint64 wire encodes a int64 pointer as a Sint64.
+// The zero value is not encoded.
+func appendSint64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int64()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ return b, nil
+}
+
+var coderSint64NoZero = pointerCoderFuncs{
+ size: sizeSint64NoZero,
+ marshal: appendSint64NoZero,
+}
+
+// sizeSint64Ptr returns the size of wire encoding a *int64 pointer as a Sint64.
+// It panics if the pointer is nil.
+func sizeSint64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := **p.Int64Ptr()
+ return tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+}
+
+// appendSint64 wire encodes a *int64 pointer as a Sint64.
+// It panics if the pointer is nil.
+func appendSint64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Int64Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ return b, nil
+}
+
+var coderSint64Ptr = pointerCoderFuncs{
+ size: sizeSint64Ptr,
+ marshal: appendSint64Ptr,
+}
+
+// sizeSint64Slice returns the size of wire encoding a []int64 pointer as a repeated Sint64.
+func sizeSint64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int64Slice()
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+ }
+ return size
+}
+
+// appendSint64Slice encodes a []int64 pointer as a repeated Sint64.
+func appendSint64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int64Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ }
+ return b, nil
+}
+
+var coderSint64Slice = pointerCoderFuncs{
+ size: sizeSint64Slice,
+ marshal: appendSint64Slice,
+}
+
+// sizeSint64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sint64.
+func sizeSint64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int64Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(wire.EncodeZigZag(v))
+ }
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64.
+func appendSint64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int64Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(wire.EncodeZigZag(v))
+ }
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ }
+ return b, nil
+}
+
+var coderSint64PackedSlice = pointerCoderFuncs{
+ size: sizeSint64PackedSlice,
+ marshal: appendSint64PackedSlice,
+}
+
+// sizeSint64Iface returns the size of wire encoding a int64 value as a Sint64.
+func sizeSint64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.(int64)
+ return tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+}
+
+// appendSint64Iface encodes a int64 value as a Sint64.
+func appendSint64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(int64)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ return b, nil
+}
+
+var coderSint64Iface = ifaceCoderFuncs{
+ size: sizeSint64Iface,
+ marshal: appendSint64Iface,
+}
+
+// sizeSint64SliceIface returns the size of wire encoding a []int64 value as a repeated Sint64.
+func sizeSint64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]int64)
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+ }
+ return size
+}
+
+// appendSint64SliceIface encodes a []int64 value as a repeated Sint64.
+func appendSint64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]int64)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ }
+ return b, nil
+}
+
+var coderSint64SliceIface = ifaceCoderFuncs{
+ size: sizeSint64SliceIface,
+ marshal: appendSint64SliceIface,
+}
+
+// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.
+func sizeUint64(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Uint64()
+ return tagsize + wire.SizeVarint(v)
+}
+
+// appendUint64 wire encodes a uint64 pointer as a Uint64.
+func appendUint64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Uint64()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, v)
+ return b, nil
+}
+
+var coderUint64 = pointerCoderFuncs{
+ size: sizeUint64,
+ marshal: appendUint64,
+}
+
+// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.
+// The zero value is not encoded.
+func sizeUint64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Uint64()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeVarint(v)
+}
+
+// appendUint64 wire encodes a uint64 pointer as a Uint64.
+// The zero value is not encoded.
+func appendUint64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Uint64()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, v)
+ return b, nil
+}
+
+var coderUint64NoZero = pointerCoderFuncs{
+ size: sizeUint64NoZero,
+ marshal: appendUint64NoZero,
+}
+
+// sizeUint64Ptr returns the size of wire encoding a *uint64 pointer as a Uint64.
+// It panics if the pointer is nil.
+func sizeUint64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := **p.Uint64Ptr()
+ return tagsize + wire.SizeVarint(v)
+}
+
+// appendUint64 wire encodes a *uint64 pointer as a Uint64.
+// It panics if the pointer is nil.
+func appendUint64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Uint64Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, v)
+ return b, nil
+}
+
+var coderUint64Ptr = pointerCoderFuncs{
+ size: sizeUint64Ptr,
+ marshal: appendUint64Ptr,
+}
+
+// sizeUint64Slice returns the size of wire encoding a []uint64 pointer as a repeated Uint64.
+func sizeUint64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Uint64Slice()
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(v)
+ }
+ return size
+}
+
+// appendUint64Slice encodes a []uint64 pointer as a repeated Uint64.
+func appendUint64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Uint64Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, v)
+ }
+ return b, nil
+}
+
+var coderUint64Slice = pointerCoderFuncs{
+ size: sizeUint64Slice,
+ marshal: appendUint64Slice,
+}
+
+// sizeUint64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Uint64.
+func sizeUint64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Uint64Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(v)
+ }
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64.
+func appendUint64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Uint64Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := 0
+ for _, v := range s {
+ n += wire.SizeVarint(v)
+ }
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendVarint(b, v)
+ }
+ return b, nil
+}
+
+var coderUint64PackedSlice = pointerCoderFuncs{
+ size: sizeUint64PackedSlice,
+ marshal: appendUint64PackedSlice,
+}
+
+// sizeUint64Iface returns the size of wire encoding a uint64 value as a Uint64.
+func sizeUint64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.(uint64)
+ return tagsize + wire.SizeVarint(v)
+}
+
+// appendUint64Iface encodes a uint64 value as a Uint64.
+func appendUint64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(uint64)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, v)
+ return b, nil
+}
+
+var coderUint64Iface = ifaceCoderFuncs{
+ size: sizeUint64Iface,
+ marshal: appendUint64Iface,
+}
+
+// sizeUint64SliceIface returns the size of wire encoding a []uint64 value as a repeated Uint64.
+func sizeUint64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]uint64)
+ for _, v := range s {
+ size += tagsize + wire.SizeVarint(v)
+ }
+ return size
+}
+
+// appendUint64SliceIface encodes a []uint64 value as a repeated Uint64.
+func appendUint64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]uint64)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendVarint(b, v)
+ }
+ return b, nil
+}
+
+var coderUint64SliceIface = ifaceCoderFuncs{
+ size: sizeUint64SliceIface,
+ marshal: appendUint64SliceIface,
+}
+
+// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.
+func sizeSfixed32(p pointer, tagsize int, _ marshalOptions) (size int) {
+
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendSfixed32 wire encodes a int32 pointer as a Sfixed32.
+func appendSfixed32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int32()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, uint32(v))
+ return b, nil
+}
+
+var coderSfixed32 = pointerCoderFuncs{
+ size: sizeSfixed32,
+ marshal: appendSfixed32,
+}
+
+// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.
+// The zero value is not encoded.
+func sizeSfixed32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int32()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendSfixed32 wire encodes a int32 pointer as a Sfixed32.
+// The zero value is not encoded.
+func appendSfixed32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int32()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, uint32(v))
+ return b, nil
+}
+
+var coderSfixed32NoZero = pointerCoderFuncs{
+ size: sizeSfixed32NoZero,
+ marshal: appendSfixed32NoZero,
+}
+
+// sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32.
+// It panics if the pointer is nil.
+func sizeSfixed32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendSfixed32 wire encodes a *int32 pointer as a Sfixed32.
+// It panics if the pointer is nil.
+func appendSfixed32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Int32Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, uint32(v))
+ return b, nil
+}
+
+var coderSfixed32Ptr = pointerCoderFuncs{
+ size: sizeSfixed32Ptr,
+ marshal: appendSfixed32Ptr,
+}
+
+// sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32.
+func sizeSfixed32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int32Slice()
+ size = len(s) * (tagsize + wire.SizeFixed32())
+ return size
+}
+
+// appendSfixed32Slice encodes a []int32 pointer as a repeated Sfixed32.
+func appendSfixed32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int32Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, uint32(v))
+ }
+ return b, nil
+}
+
+var coderSfixed32Slice = pointerCoderFuncs{
+ size: sizeSfixed32Slice,
+ marshal: appendSfixed32Slice,
+}
+
+// sizeSfixed32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sfixed32.
+func sizeSfixed32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int32Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := len(s) * wire.SizeFixed32()
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32.
+func appendSfixed32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int32Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := len(s) * wire.SizeFixed32()
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendFixed32(b, uint32(v))
+ }
+ return b, nil
+}
+
+var coderSfixed32PackedSlice = pointerCoderFuncs{
+ size: sizeSfixed32PackedSlice,
+ marshal: appendSfixed32PackedSlice,
+}
+
+// sizeSfixed32Iface returns the size of wire encoding a int32 value as a Sfixed32.
+func sizeSfixed32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendSfixed32Iface encodes a int32 value as a Sfixed32.
+func appendSfixed32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(int32)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, uint32(v))
+ return b, nil
+}
+
+var coderSfixed32Iface = ifaceCoderFuncs{
+ size: sizeSfixed32Iface,
+ marshal: appendSfixed32Iface,
+}
+
+// sizeSfixed32SliceIface returns the size of wire encoding a []int32 value as a repeated Sfixed32.
+func sizeSfixed32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]int32)
+ size = len(s) * (tagsize + wire.SizeFixed32())
+ return size
+}
+
+// appendSfixed32SliceIface encodes a []int32 value as a repeated Sfixed32.
+func appendSfixed32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]int32)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, uint32(v))
+ }
+ return b, nil
+}
+
+var coderSfixed32SliceIface = ifaceCoderFuncs{
+ size: sizeSfixed32SliceIface,
+ marshal: appendSfixed32SliceIface,
+}
+
+// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.
+func sizeFixed32(p pointer, tagsize int, _ marshalOptions) (size int) {
+
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendFixed32 wire encodes a uint32 pointer as a Fixed32.
+func appendFixed32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Uint32()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, v)
+ return b, nil
+}
+
+var coderFixed32 = pointerCoderFuncs{
+ size: sizeFixed32,
+ marshal: appendFixed32,
+}
+
+// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.
+// The zero value is not encoded.
+func sizeFixed32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Uint32()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendFixed32 wire encodes a uint32 pointer as a Fixed32.
+// The zero value is not encoded.
+func appendFixed32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Uint32()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, v)
+ return b, nil
+}
+
+var coderFixed32NoZero = pointerCoderFuncs{
+ size: sizeFixed32NoZero,
+ marshal: appendFixed32NoZero,
+}
+
+// sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32.
+// It panics if the pointer is nil.
+func sizeFixed32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendFixed32 wire encodes a *uint32 pointer as a Fixed32.
+// It panics if the pointer is nil.
+func appendFixed32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Uint32Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, v)
+ return b, nil
+}
+
+var coderFixed32Ptr = pointerCoderFuncs{
+ size: sizeFixed32Ptr,
+ marshal: appendFixed32Ptr,
+}
+
+// sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32.
+func sizeFixed32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Uint32Slice()
+ size = len(s) * (tagsize + wire.SizeFixed32())
+ return size
+}
+
+// appendFixed32Slice encodes a []uint32 pointer as a repeated Fixed32.
+func appendFixed32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Uint32Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, v)
+ }
+ return b, nil
+}
+
+var coderFixed32Slice = pointerCoderFuncs{
+ size: sizeFixed32Slice,
+ marshal: appendFixed32Slice,
+}
+
+// sizeFixed32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Fixed32.
+func sizeFixed32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Uint32Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := len(s) * wire.SizeFixed32()
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32.
+func appendFixed32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Uint32Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := len(s) * wire.SizeFixed32()
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendFixed32(b, v)
+ }
+ return b, nil
+}
+
+var coderFixed32PackedSlice = pointerCoderFuncs{
+ size: sizeFixed32PackedSlice,
+ marshal: appendFixed32PackedSlice,
+}
+
+// sizeFixed32Iface returns the size of wire encoding a uint32 value as a Fixed32.
+func sizeFixed32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendFixed32Iface encodes a uint32 value as a Fixed32.
+func appendFixed32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(uint32)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, v)
+ return b, nil
+}
+
+var coderFixed32Iface = ifaceCoderFuncs{
+ size: sizeFixed32Iface,
+ marshal: appendFixed32Iface,
+}
+
+// sizeFixed32SliceIface returns the size of wire encoding a []uint32 value as a repeated Fixed32.
+func sizeFixed32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]uint32)
+ size = len(s) * (tagsize + wire.SizeFixed32())
+ return size
+}
+
+// appendFixed32SliceIface encodes a []uint32 value as a repeated Fixed32.
+func appendFixed32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]uint32)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, v)
+ }
+ return b, nil
+}
+
+var coderFixed32SliceIface = ifaceCoderFuncs{
+ size: sizeFixed32SliceIface,
+ marshal: appendFixed32SliceIface,
+}
+
+// sizeFloat returns the size of wire encoding a float32 pointer as a Float.
+func sizeFloat(p pointer, tagsize int, _ marshalOptions) (size int) {
+
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendFloat wire encodes a float32 pointer as a Float.
+func appendFloat(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Float32()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, math.Float32bits(v))
+ return b, nil
+}
+
+var coderFloat = pointerCoderFuncs{
+ size: sizeFloat,
+ marshal: appendFloat,
+}
+
+// sizeFloat returns the size of wire encoding a float32 pointer as a Float.
+// The zero value is not encoded.
+func sizeFloatNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Float32()
+ if v == 0 && !math.Signbit(float64(v)) {
+ return 0
+ }
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendFloat wire encodes a float32 pointer as a Float.
+// The zero value is not encoded.
+func appendFloatNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Float32()
+ if v == 0 && !math.Signbit(float64(v)) {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, math.Float32bits(v))
+ return b, nil
+}
+
+var coderFloatNoZero = pointerCoderFuncs{
+ size: sizeFloatNoZero,
+ marshal: appendFloatNoZero,
+}
+
+// sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float.
+// It panics if the pointer is nil.
+func sizeFloatPtr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendFloat wire encodes a *float32 pointer as a Float.
+// It panics if the pointer is nil.
+func appendFloatPtr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Float32Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, math.Float32bits(v))
+ return b, nil
+}
+
+var coderFloatPtr = pointerCoderFuncs{
+ size: sizeFloatPtr,
+ marshal: appendFloatPtr,
+}
+
+// sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float.
+func sizeFloatSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Float32Slice()
+ size = len(s) * (tagsize + wire.SizeFixed32())
+ return size
+}
+
+// appendFloatSlice encodes a []float32 pointer as a repeated Float.
+func appendFloatSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Float32Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, math.Float32bits(v))
+ }
+ return b, nil
+}
+
+var coderFloatSlice = pointerCoderFuncs{
+ size: sizeFloatSlice,
+ marshal: appendFloatSlice,
+}
+
+// sizeFloatPackedSlice returns the size of wire encoding a []float32 pointer as a packed repeated Float.
+func sizeFloatPackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Float32Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := len(s) * wire.SizeFixed32()
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float.
+func appendFloatPackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Float32Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := len(s) * wire.SizeFixed32()
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendFixed32(b, math.Float32bits(v))
+ }
+ return b, nil
+}
+
+var coderFloatPackedSlice = pointerCoderFuncs{
+ size: sizeFloatPackedSlice,
+ marshal: appendFloatPackedSlice,
+}
+
+// sizeFloatIface returns the size of wire encoding a float32 value as a Float.
+func sizeFloatIface(ival interface{}, tagsize int, _ marshalOptions) int {
+ return tagsize + wire.SizeFixed32()
+}
+
+// appendFloatIface encodes a float32 value as a Float.
+func appendFloatIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(float32)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, math.Float32bits(v))
+ return b, nil
+}
+
+var coderFloatIface = ifaceCoderFuncs{
+ size: sizeFloatIface,
+ marshal: appendFloatIface,
+}
+
+// sizeFloatSliceIface returns the size of wire encoding a []float32 value as a repeated Float.
+func sizeFloatSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]float32)
+ size = len(s) * (tagsize + wire.SizeFixed32())
+ return size
+}
+
+// appendFloatSliceIface encodes a []float32 value as a repeated Float.
+func appendFloatSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]float32)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed32(b, math.Float32bits(v))
+ }
+ return b, nil
+}
+
+var coderFloatSliceIface = ifaceCoderFuncs{
+ size: sizeFloatSliceIface,
+ marshal: appendFloatSliceIface,
+}
+
+// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.
+func sizeSfixed64(p pointer, tagsize int, _ marshalOptions) (size int) {
+
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendSfixed64 wire encodes a int64 pointer as a Sfixed64.
+func appendSfixed64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int64()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, uint64(v))
+ return b, nil
+}
+
+var coderSfixed64 = pointerCoderFuncs{
+ size: sizeSfixed64,
+ marshal: appendSfixed64,
+}
+
+// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.
+// The zero value is not encoded.
+func sizeSfixed64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Int64()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendSfixed64 wire encodes a int64 pointer as a Sfixed64.
+// The zero value is not encoded.
+func appendSfixed64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Int64()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, uint64(v))
+ return b, nil
+}
+
+var coderSfixed64NoZero = pointerCoderFuncs{
+ size: sizeSfixed64NoZero,
+ marshal: appendSfixed64NoZero,
+}
+
+// sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64.
+// It panics if the pointer is nil.
+func sizeSfixed64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendSfixed64 wire encodes a *int64 pointer as a Sfixed64.
+// It panics if the pointer is nil.
+func appendSfixed64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Int64Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, uint64(v))
+ return b, nil
+}
+
+var coderSfixed64Ptr = pointerCoderFuncs{
+ size: sizeSfixed64Ptr,
+ marshal: appendSfixed64Ptr,
+}
+
+// sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64.
+func sizeSfixed64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int64Slice()
+ size = len(s) * (tagsize + wire.SizeFixed64())
+ return size
+}
+
+// appendSfixed64Slice encodes a []int64 pointer as a repeated Sfixed64.
+func appendSfixed64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int64Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderSfixed64Slice = pointerCoderFuncs{
+ size: sizeSfixed64Slice,
+ marshal: appendSfixed64Slice,
+}
+
+// sizeSfixed64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sfixed64.
+func sizeSfixed64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Int64Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := len(s) * wire.SizeFixed64()
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64.
+func appendSfixed64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Int64Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := len(s) * wire.SizeFixed64()
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendFixed64(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderSfixed64PackedSlice = pointerCoderFuncs{
+ size: sizeSfixed64PackedSlice,
+ marshal: appendSfixed64PackedSlice,
+}
+
+// sizeSfixed64Iface returns the size of wire encoding a int64 value as a Sfixed64.
+func sizeSfixed64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendSfixed64Iface encodes a int64 value as a Sfixed64.
+func appendSfixed64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(int64)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, uint64(v))
+ return b, nil
+}
+
+var coderSfixed64Iface = ifaceCoderFuncs{
+ size: sizeSfixed64Iface,
+ marshal: appendSfixed64Iface,
+}
+
+// sizeSfixed64SliceIface returns the size of wire encoding a []int64 value as a repeated Sfixed64.
+func sizeSfixed64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]int64)
+ size = len(s) * (tagsize + wire.SizeFixed64())
+ return size
+}
+
+// appendSfixed64SliceIface encodes a []int64 value as a repeated Sfixed64.
+func appendSfixed64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]int64)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, uint64(v))
+ }
+ return b, nil
+}
+
+var coderSfixed64SliceIface = ifaceCoderFuncs{
+ size: sizeSfixed64SliceIface,
+ marshal: appendSfixed64SliceIface,
+}
+
+// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.
+func sizeFixed64(p pointer, tagsize int, _ marshalOptions) (size int) {
+
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendFixed64 wire encodes a uint64 pointer as a Fixed64.
+func appendFixed64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Uint64()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, v)
+ return b, nil
+}
+
+var coderFixed64 = pointerCoderFuncs{
+ size: sizeFixed64,
+ marshal: appendFixed64,
+}
+
+// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.
+// The zero value is not encoded.
+func sizeFixed64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Uint64()
+ if v == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendFixed64 wire encodes a uint64 pointer as a Fixed64.
+// The zero value is not encoded.
+func appendFixed64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Uint64()
+ if v == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, v)
+ return b, nil
+}
+
+var coderFixed64NoZero = pointerCoderFuncs{
+ size: sizeFixed64NoZero,
+ marshal: appendFixed64NoZero,
+}
+
+// sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64.
+// It panics if the pointer is nil.
+func sizeFixed64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendFixed64 wire encodes a *uint64 pointer as a Fixed64.
+// It panics if the pointer is nil.
+func appendFixed64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Uint64Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, v)
+ return b, nil
+}
+
+var coderFixed64Ptr = pointerCoderFuncs{
+ size: sizeFixed64Ptr,
+ marshal: appendFixed64Ptr,
+}
+
+// sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64.
+func sizeFixed64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Uint64Slice()
+ size = len(s) * (tagsize + wire.SizeFixed64())
+ return size
+}
+
+// appendFixed64Slice encodes a []uint64 pointer as a repeated Fixed64.
+func appendFixed64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Uint64Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, v)
+ }
+ return b, nil
+}
+
+var coderFixed64Slice = pointerCoderFuncs{
+ size: sizeFixed64Slice,
+ marshal: appendFixed64Slice,
+}
+
+// sizeFixed64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Fixed64.
+func sizeFixed64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Uint64Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := len(s) * wire.SizeFixed64()
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64.
+func appendFixed64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Uint64Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := len(s) * wire.SizeFixed64()
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendFixed64(b, v)
+ }
+ return b, nil
+}
+
+var coderFixed64PackedSlice = pointerCoderFuncs{
+ size: sizeFixed64PackedSlice,
+ marshal: appendFixed64PackedSlice,
+}
+
+// sizeFixed64Iface returns the size of wire encoding a uint64 value as a Fixed64.
+func sizeFixed64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendFixed64Iface encodes a uint64 value as a Fixed64.
+func appendFixed64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(uint64)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, v)
+ return b, nil
+}
+
+var coderFixed64Iface = ifaceCoderFuncs{
+ size: sizeFixed64Iface,
+ marshal: appendFixed64Iface,
+}
+
+// sizeFixed64SliceIface returns the size of wire encoding a []uint64 value as a repeated Fixed64.
+func sizeFixed64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]uint64)
+ size = len(s) * (tagsize + wire.SizeFixed64())
+ return size
+}
+
+// appendFixed64SliceIface encodes a []uint64 value as a repeated Fixed64.
+func appendFixed64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]uint64)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, v)
+ }
+ return b, nil
+}
+
+var coderFixed64SliceIface = ifaceCoderFuncs{
+ size: sizeFixed64SliceIface,
+ marshal: appendFixed64SliceIface,
+}
+
+// sizeDouble returns the size of wire encoding a float64 pointer as a Double.
+func sizeDouble(p pointer, tagsize int, _ marshalOptions) (size int) {
+
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendDouble wire encodes a float64 pointer as a Double.
+func appendDouble(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Float64()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, math.Float64bits(v))
+ return b, nil
+}
+
+var coderDouble = pointerCoderFuncs{
+ size: sizeDouble,
+ marshal: appendDouble,
+}
+
+// sizeDouble returns the size of wire encoding a float64 pointer as a Double.
+// The zero value is not encoded.
+func sizeDoubleNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Float64()
+ if v == 0 && !math.Signbit(float64(v)) {
+ return 0
+ }
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendDouble wire encodes a float64 pointer as a Double.
+// The zero value is not encoded.
+func appendDoubleNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Float64()
+ if v == 0 && !math.Signbit(float64(v)) {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, math.Float64bits(v))
+ return b, nil
+}
+
+var coderDoubleNoZero = pointerCoderFuncs{
+ size: sizeDoubleNoZero,
+ marshal: appendDoubleNoZero,
+}
+
+// sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double.
+// It panics if the pointer is nil.
+func sizeDoublePtr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendDouble wire encodes a *float64 pointer as a Double.
+// It panics if the pointer is nil.
+func appendDoublePtr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.Float64Ptr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, math.Float64bits(v))
+ return b, nil
+}
+
+var coderDoublePtr = pointerCoderFuncs{
+ size: sizeDoublePtr,
+ marshal: appendDoublePtr,
+}
+
+// sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double.
+func sizeDoubleSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Float64Slice()
+ size = len(s) * (tagsize + wire.SizeFixed64())
+ return size
+}
+
+// appendDoubleSlice encodes a []float64 pointer as a repeated Double.
+func appendDoubleSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Float64Slice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, math.Float64bits(v))
+ }
+ return b, nil
+}
+
+var coderDoubleSlice = pointerCoderFuncs{
+ size: sizeDoubleSlice,
+ marshal: appendDoubleSlice,
+}
+
+// sizeDoublePackedSlice returns the size of wire encoding a []float64 pointer as a packed repeated Double.
+func sizeDoublePackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.Float64Slice()
+ if len(s) == 0 {
+ return 0
+ }
+ n := len(s) * wire.SizeFixed64()
+ return tagsize + wire.SizeBytes(n)
+}
+
+// appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double.
+func appendDoublePackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.Float64Slice()
+ if len(s) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ n := len(s) * wire.SizeFixed64()
+ b = wire.AppendVarint(b, uint64(n))
+ for _, v := range s {
+ b = wire.AppendFixed64(b, math.Float64bits(v))
+ }
+ return b, nil
+}
+
+var coderDoublePackedSlice = pointerCoderFuncs{
+ size: sizeDoublePackedSlice,
+ marshal: appendDoublePackedSlice,
+}
+
+// sizeDoubleIface returns the size of wire encoding a float64 value as a Double.
+func sizeDoubleIface(ival interface{}, tagsize int, _ marshalOptions) int {
+ return tagsize + wire.SizeFixed64()
+}
+
+// appendDoubleIface encodes a float64 value as a Double.
+func appendDoubleIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(float64)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, math.Float64bits(v))
+ return b, nil
+}
+
+var coderDoubleIface = ifaceCoderFuncs{
+ size: sizeDoubleIface,
+ marshal: appendDoubleIface,
+}
+
+// sizeDoubleSliceIface returns the size of wire encoding a []float64 value as a repeated Double.
+func sizeDoubleSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]float64)
+ size = len(s) * (tagsize + wire.SizeFixed64())
+ return size
+}
+
+// appendDoubleSliceIface encodes a []float64 value as a repeated Double.
+func appendDoubleSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]float64)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendFixed64(b, math.Float64bits(v))
+ }
+ return b, nil
+}
+
+var coderDoubleSliceIface = ifaceCoderFuncs{
+ size: sizeDoubleSliceIface,
+ marshal: appendDoubleSliceIface,
+}
+
+// sizeString returns the size of wire encoding a string pointer as a String.
+func sizeString(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.String()
+ return tagsize + wire.SizeBytes(len([]byte(v)))
+}
+
+// appendString wire encodes a string pointer as a String.
+func appendString(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.String()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, []byte(v))
+ return b, nil
+}
+
+var coderString = pointerCoderFuncs{
+ size: sizeString,
+ marshal: appendString,
+}
+
+// sizeString returns the size of wire encoding a string pointer as a String.
+// The zero value is not encoded.
+func sizeStringNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.String()
+ if len(v) == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeBytes(len([]byte(v)))
+}
+
+// appendString wire encodes a string pointer as a String.
+// The zero value is not encoded.
+func appendStringNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.String()
+ if len(v) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, []byte(v))
+ return b, nil
+}
+
+var coderStringNoZero = pointerCoderFuncs{
+ size: sizeStringNoZero,
+ marshal: appendStringNoZero,
+}
+
+// sizeStringPtr returns the size of wire encoding a *string pointer as a String.
+// It panics if the pointer is nil.
+func sizeStringPtr(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := **p.StringPtr()
+ return tagsize + wire.SizeBytes(len([]byte(v)))
+}
+
+// appendString wire encodes a *string pointer as a String.
+// It panics if the pointer is nil.
+func appendStringPtr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := **p.StringPtr()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, []byte(v))
+ return b, nil
+}
+
+var coderStringPtr = pointerCoderFuncs{
+ size: sizeStringPtr,
+ marshal: appendStringPtr,
+}
+
+// sizeStringSlice returns the size of wire encoding a []string pointer as a repeated String.
+func sizeStringSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.StringSlice()
+ for _, v := range s {
+ size += tagsize + wire.SizeBytes(len([]byte(v)))
+ }
+ return size
+}
+
+// appendStringSlice encodes a []string pointer as a repeated String.
+func appendStringSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.StringSlice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, []byte(v))
+ }
+ return b, nil
+}
+
+var coderStringSlice = pointerCoderFuncs{
+ size: sizeStringSlice,
+ marshal: appendStringSlice,
+}
+
+// sizeStringIface returns the size of wire encoding a string value as a String.
+func sizeStringIface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.(string)
+ return tagsize + wire.SizeBytes(len([]byte(v)))
+}
+
+// appendStringIface encodes a string value as a String.
+func appendStringIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.(string)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, []byte(v))
+ return b, nil
+}
+
+var coderStringIface = ifaceCoderFuncs{
+ size: sizeStringIface,
+ marshal: appendStringIface,
+}
+
+// sizeStringSliceIface returns the size of wire encoding a []string value as a repeated String.
+func sizeStringSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[]string)
+ for _, v := range s {
+ size += tagsize + wire.SizeBytes(len([]byte(v)))
+ }
+ return size
+}
+
+// appendStringSliceIface encodes a []string value as a repeated String.
+func appendStringSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[]string)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, []byte(v))
+ }
+ return b, nil
+}
+
+var coderStringSliceIface = ifaceCoderFuncs{
+ size: sizeStringSliceIface,
+ marshal: appendStringSliceIface,
+}
+
+// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.
+func sizeBytes(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Bytes()
+ return tagsize + wire.SizeBytes(len(v))
+}
+
+// appendBytes wire encodes a []byte pointer as a Bytes.
+func appendBytes(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Bytes()
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, v)
+ return b, nil
+}
+
+var coderBytes = pointerCoderFuncs{
+ size: sizeBytes,
+ marshal: appendBytes,
+}
+
+// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.
+// The zero value is not encoded.
+func sizeBytesNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
+ v := *p.Bytes()
+ if len(v) == 0 {
+ return 0
+ }
+ return tagsize + wire.SizeBytes(len(v))
+}
+
+// appendBytes wire encodes a []byte pointer as a Bytes.
+// The zero value is not encoded.
+func appendBytesNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := *p.Bytes()
+ if len(v) == 0 {
+ return b, nil
+ }
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, v)
+ return b, nil
+}
+
+var coderBytesNoZero = pointerCoderFuncs{
+ size: sizeBytesNoZero,
+ marshal: appendBytesNoZero,
+}
+
+// sizeBytesSlice returns the size of wire encoding a [][]byte pointer as a repeated Bytes.
+func sizeBytesSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
+ s := *p.BytesSlice()
+ for _, v := range s {
+ size += tagsize + wire.SizeBytes(len(v))
+ }
+ return size
+}
+
+// appendBytesSlice encodes a [][]byte pointer as a repeated Bytes.
+func appendBytesSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *p.BytesSlice()
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, v)
+ }
+ return b, nil
+}
+
+var coderBytesSlice = pointerCoderFuncs{
+ size: sizeBytesSlice,
+ marshal: appendBytesSlice,
+}
+
+// sizeBytesIface returns the size of wire encoding a []byte value as a Bytes.
+func sizeBytesIface(ival interface{}, tagsize int, _ marshalOptions) int {
+ v := ival.([]byte)
+ return tagsize + wire.SizeBytes(len(v))
+}
+
+// appendBytesIface encodes a []byte value as a Bytes.
+func appendBytesIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ v := ival.([]byte)
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, v)
+ return b, nil
+}
+
+var coderBytesIface = ifaceCoderFuncs{
+ size: sizeBytesIface,
+ marshal: appendBytesIface,
+}
+
+// sizeBytesSliceIface returns the size of wire encoding a [][]byte value as a repeated Bytes.
+func sizeBytesSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
+ s := *ival.(*[][]byte)
+ for _, v := range s {
+ size += tagsize + wire.SizeBytes(len(v))
+ }
+ return size
+}
+
+// appendBytesSliceIface encodes a [][]byte value as a repeated Bytes.
+func appendBytesSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
+ s := *ival.(*[][]byte)
+ for _, v := range s {
+ b = wire.AppendVarint(b, wiretag)
+ b = wire.AppendBytes(b, v)
+ }
+ return b, nil
+}
+
+var coderBytesSliceIface = ifaceCoderFuncs{
+ size: sizeBytesSliceIface,
+ marshal: appendBytesSliceIface,
+}
+
+var wireTypes = map[protoreflect.Kind]wire.Type{
+ protoreflect.BoolKind: wire.VarintType,
+ protoreflect.EnumKind: wire.VarintType,
+ protoreflect.Int32Kind: wire.VarintType,
+ protoreflect.Sint32Kind: wire.VarintType,
+ protoreflect.Uint32Kind: wire.VarintType,
+ protoreflect.Int64Kind: wire.VarintType,
+ protoreflect.Sint64Kind: wire.VarintType,
+ protoreflect.Uint64Kind: wire.VarintType,
+ protoreflect.Sfixed32Kind: wire.Fixed32Type,
+ protoreflect.Fixed32Kind: wire.Fixed32Type,
+ protoreflect.FloatKind: wire.Fixed32Type,
+ protoreflect.Sfixed64Kind: wire.Fixed64Type,
+ protoreflect.Fixed64Kind: wire.Fixed64Type,
+ protoreflect.DoubleKind: wire.Fixed64Type,
+ protoreflect.StringKind: wire.BytesType,
+ protoreflect.BytesKind: wire.BytesType,
+ protoreflect.MessageKind: wire.BytesType,
+ protoreflect.GroupKind: wire.StartGroupType,
+}