func consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
	if wtyp != protowire.VarintType {
		return out, errUnknown
	}
	var v uint64
	var n int
	if len(b) >= 1 && b[0] < 0x80 {
		v = uint64(b[0])
		n = 1
	} else if len(b) >= 2 && b[1] < 128 {
		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
		n = 2
	} else {
		v, n = protowire.ConsumeVarint(b)
	}
	if n < 0 {
		return out, protowire.ParseError(n)
	}
	*p.Int32() = int32(v)
	out.n = n
	return out, nil
}
consumeInt32 wire decodes a int32 pointer as a Int32.
package impl
import (
	"math"
	"unicode/utf8"
	"google.golang.org/protobuf/encoding/protowire"
	"google.golang.org/protobuf/reflect/protoreflect"
)
func sizeBool(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
	v := *p.Bool()
	return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
}
func appendBool(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
	v := *p.Bool()
	b = protowire.AppendVarint(b, f.wiretag)
	b = protowire.AppendVarint(b, protowire.EncodeBool(v))
	return b, nil
}
func consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
	if wtyp != protowire.VarintType {
		return out, errUnknown
	}
	var v uint64
	var n int
	if len(b) >= 1 && b[0] < 0x80 {
		v = uint64(b[0])
		n = 1
	} else if len(b) >= 2 && b[1] < 128 {
		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
		n = 2
	} else {
		v, n = protowire.ConsumeVarint(b)
	}
	if n < 0 {
		return out, protowire.ParseError(n)
	}
	*p.Bool() = protowire.DecodeBool(v)
	out.n = n
	return out, nil
}
var coderBool = pointerCoderFuncs{
	size:      sizeBool,
	marshal:   appendBool,
	unmarshal: consumeBool,
	merge:     mergeBool,
}
func sizeBoolNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
	v := *p.Bool()
	if v == false {
		return 0
	}
	return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
}
func appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
	v := *p.Bool()
	if v == false {
		return b, nil
	}
	b = protowire.AppendVarint(b, f.wiretag)
	b = protowire.AppendVarint(b, protowire.EncodeBool(v))
	return b, nil
}
var coderBoolNoZero = pointerCoderFuncs{
	size:      sizeBoolNoZero,
	marshal:   appendBoolNoZero,
	unmarshal: consumeBool,
	merge:     mergeBoolNoZero,
}
func sizeBoolPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
	v := **p.BoolPtr()
	return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
}
func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
	v := **p.BoolPtr()
	b = protowire.AppendVarint(b, f.wiretag)
	b = protowire.AppendVarint(b, protowire.EncodeBool(v))
	return b, nil
}
func consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
	if wtyp != protowire.VarintType {
		return out, errUnknown
	}
	var v uint64
	var n int
	if len(b) >= 1 && b[0] < 0x80 {
		v = uint64(b[0])
		n = 1
	} else if len(b) >= 2 && b[1] < 128 {
		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
		n = 2
	} else {
		v, n = protowire.ConsumeVarint(b)
	}
	if n < 0 {
		return out, protowire.ParseError(n)
	}
	vp := p.BoolPtr()
	if *vp == nil {
		*vp = new(bool)
	}
	**vp = protowire.DecodeBool(v)
	out.n = n
	return out, nil
}
var coderBoolPtr = pointerCoderFuncs{
	size:      sizeBoolPtr,
	marshal:   appendBoolPtr,
	unmarshal: consumeBoolPtr,
	merge:     mergeBoolPtr,
}
func sizeBoolSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
	s := *p.BoolSlice()
	for _, v := range s {
		size += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
	}
	return size
}
func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
	s := *p.BoolSlice()
	for _, v := range s {
		b = protowire.AppendVarint(b, f.wiretag)
		b = protowire.AppendVarint(b, protowire.EncodeBool(v))
	}
	return b, nil
}
func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
	sp := p.BoolSlice()
	if wtyp == protowire.BytesType {
		s := *sp
		b, n := protowire.ConsumeBytes(b)
		if n < 0 {
			return out, protowire.ParseError(n)
		}
		for len(b) > 0 {
			var v uint64
			var n int
			if len(b) >= 1 && b[0] < 0x80 {
				v = uint64(b[0])
				n = 1
			} else if len(b) >= 2 && b[1] < 128 {
				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
				n = 2
			} else {
				v, n = protowire.ConsumeVarint(b)
			}
			if n < 0 {
				return out, protowire.ParseError(n)
			}
			s = append(s, protowire.DecodeBool(v))
			b = b[n:]
		}
		*sp = s
		out.n = n
		return out, nil
	}
	if wtyp != protowire.VarintType {
		return out, errUnknown
	}
	var v uint64
	var n int
	if len(b) >= 1 && b[0] < 0x80 {
		v = uint64(b[0])
		n = 1
	} else if len(b) >= 2 && b[1] < 128 {
		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
		n = 2
	} else {
		v, n = protowire.ConsumeVarint(b)
	}
	if n < 0 {
		return out, protowire.ParseError(n)
	}
	*sp = append(*sp, protowire.DecodeBool(v))
	out.n = n
	return out, nil
}
var coderBoolSlice = pointerCoderFuncs{
	size:      sizeBoolSlice,
	marshal:   appendBoolSlice,
	unmarshal: consumeBoolSlice,
	merge:     mergeBoolSlice,
}
func sizeBoolPackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
	s := *p.BoolSlice()
	if len(s) == 0 {
		return 0
	}
	n := 0
	for _, v := range s {
		n += protowire.SizeVarint(protowire.EncodeBool(v))
	}
	return f.tagsize + protowire.SizeBytes(n)
}
func appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
	s := *p.BoolSlice()
	if len(s) == 0 {
		return b, nil
	}
	b = protowire.AppendVarint(b, f.wiretag)
	n := 0
	for _, v := range s {
		n += protowire.SizeVarint(protowire.EncodeBool(v))
	}
	b = protowire.AppendVarint(b, uint64(n))
	for _, v := range s {
		b = protowire.AppendVarint(b, protowire.EncodeBool(v))
	}
	return b, nil
}
var coderBoolPackedSlice = pointerCoderFuncs{
	size:      sizeBoolPackedSlice,
	marshal:   appendBoolPackedSlice,
	unmarshal: consumeBoolSlice,
	merge:     mergeBoolSlice,
}
func sizeBoolValue(v protoreflect.Value, tagsize int, _ marshalOptions) int {
	return tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
}
func appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
	b = protowire.AppendVarint(b, wiretag)
	b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
	return b, nil
}
func consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
	if wtyp != protowire.VarintType {
		return protoreflect.Value{}, out, errUnknown
	}
	var v uint64
	var n int
	if len(b) >= 1 && b[0] < 0x80 {
		v = uint64(b[0])
		n = 1
	} else if len(b) >= 2 && b[1] < 128 {
		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
		n = 2
	} else {
		v, n = protowire.ConsumeVarint(b)
	}
	if n < 0 {
		return protoreflect.Value{}, out, protowire.ParseError(n)
	}
	out.n = n
	return protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil
}
var coderBoolValue = valueCoderFuncs{
	size:      sizeBoolValue,
	marshal:   appendBoolValue,
	unmarshal: consumeBoolValue,
	merge:     mergeScalarValue,
}
func sizeBoolSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
	list := listv.List()
	for i, llen := 0, list.Len(); i < llen; i++ {
		v := list.Get(i)
		size += tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
	}
	return size
}
func appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
	list := listv.List()
	for i, llen := 0, list.Len(); i < llen; i++ {
		v := list.Get(i)
		b = protowire.AppendVarint(b, wiretag)
		b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
	}
	return b, nil
}
func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
	list := listv.List()
	if wtyp == protowire.BytesType {
		b, n := protowire.ConsumeBytes(b)
		if n < 0 {
			return protoreflect.Value{}, out, protowire.ParseError(n)
		}
		for len(b) > 0 {
			var v uint64
			var n int
			if len(b) >= 1 && b[0] < 0x80 {
				v = uint64(b[0])
				n = 1
			} else if len(b) >= 2 && b[1] < 128 {
				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
				n = 2
			} else {
				v, n = protowire.ConsumeVarint(b)
			}
			if n < 0 {
				return protoreflect.Value{}, out, protowire.ParseError(n)
			}
			list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
			b = b[n:]
		}
		out.n = n
		return listv, out, nil
	}
	if wtyp != protowire.VarintType {
		return protoreflect.Value{}, out, errUnknown
	}
	var v uint64
	var n int
	if len(b) >= 1 && b[0] < 0x80 {
		v = uint64(b[0])
		n = 1
	} else if len(b) >= 2 && b[1] < 128 {
		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
		n = 2
	} else {
		v, n = protowire.ConsumeVarint(b)
	}
	if n < 0 {
		return protoreflect.Value{}, out, protowire.ParseError(n)
	}
	list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
	out.n = n
	return listv, out, nil
}
var coderBoolSliceValue = valueCoderFuncs{
	size:      sizeBoolSliceValue,
	marshal:   appendBoolSliceValue,
	unmarshal: consumeBoolSliceValue,
	merge:     mergeListValue,
}
func sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
	list := listv.List()
	llen := list.Len()
	if llen == 0 {
		return 0
	}
	n := 0
	for i, llen := 0, llen; i < llen; i++ {
		v := list.Get(i)
		n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
	}
	return tagsize + protowire.SizeBytes(n)
}
func appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
	list := listv.List()
	llen := list.Len()
	if llen == 0 {
		return b, nil
	}
	b = protowire.AppendVarint(b, wiretag)
	n := 0
	for i := 0; i < llen; i++ {
		v := list.Get(i)
		n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
	}
	b = protowire.AppendVarint(b, uint64(n))
	for i := 0; i < llen; i++ {
		v := list.Get(i)
		b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
	}
	return b, nil
}
var coderBoolPackedSliceValue = valueCoderFuncs{
	size:      sizeBoolPackedSliceValue,
	marshal:   appendBoolPackedSliceValue,
	unmarshal: consumeBoolSliceValue,
	merge:     mergeListValue,
}
func sizeEnumValue(v protoreflect.Value, tagsize int, _ marshalOptions) int {
	return tagsize + protowire.SizeVarint(uint64(v.Enum()))
}
func appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
	b = protowire.AppendVarint(b, wiretag)
	b = protowire.AppendVarint(b, uint64(v.Enum()))
	return b, nil
}
func consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
	if wtyp != protowire.VarintType {
		return protoreflect.Value{}, out, errUnknown
	}
	var v uint64
	var n int
	if len(b) >= 1 && b[0] < 0x80 {
		v = uint64(b[0])
		n = 1
	} else if len(b) >= 2 && b[1] < 128 {
		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
		n = 2
	} else {
		v, n = protowire.ConsumeVarint(b)
	}
	if n < 0 {
		return protoreflect.Value{}, out, protowire.ParseError(n)
	}
	out.n = n
	return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil
}
var coderEnumValue = valueCoderFuncs{
	size:      sizeEnumValue,
	marshal:   appendEnumValue,
	unmarshal: consumeEnumValue,
	merge:     mergeScalarValue,
}
func sizeEnumSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
	list := listv.List()
	for i, llen := 0, list.Len(); i < llen; i++ {
		v := list.Get(i)
		size += tagsize + protowire.SizeVarint(uint64(v.Enum()))
	}
	return size
}
func appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
	list := listv.List()
	for i, llen := 0, list.Len(); i < llen; i++ {
		v := list.Get(i)
		b = protowire.AppendVarint(b, wiretag)
		b = protowire.AppendVarint(b, uint64(v.Enum()))
	}
	return b, nil
}
func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
	list := listv.List()
	if wtyp == protowire.BytesType {
		b, n := protowire.ConsumeBytes(b)
		if n < 0 {
			return protoreflect.Value{}, out, protowire.ParseError(n)
		}
		for len(b) > 0 {
			var v uint64
			var n int
			if len(b) >= 1 && b[0] < 0x80 {
				v = uint64(b[0])
				n = 1
			} else if len(b) >= 2 && b[1] < 128 {
				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
				n = 2
			} else {
				v, n = protowire.ConsumeVarint(b)
			}
			if n < 0 {
				return protoreflect.Value{}, out, protowire.ParseError(n)
			}
			list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
			b = b[n:]
		}
		out.n = n
		return listv, out, nil
	}
	if wtyp != protowire.VarintType {
		return protoreflect.Value{}, out, errUnknown
	}
	var v uint64
	var n int
	if len(b) >= 1 && b[0] < 0x80 {
		v = uint64(b[0])
		n = 1
	} else if len(b) >= 2 && b[1] < 128 {
		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
		n = 2
	} else {
		v, n = protowire.ConsumeVarint(b)
	}
	if n < 0 {
		return protoreflect.Value{}, out, protowire.ParseError(n)
	}
	list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
	out.n = n
	return listv, out, nil
}
var coderEnumSliceValue = valueCoderFuncs{
	size:      sizeEnumSliceValue,
	marshal:   appendEnumSliceValue,
	unmarshal: consumeEnumSliceValue,
	merge:     mergeListValue,
}
func sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
	list := listv.List()
	llen := list.Len()
	if llen == 0 {
		return 0
	}
	n := 0
	for i, llen := 0, llen; i < llen; i++ {
		v := list.Get(i)
		n += protowire.SizeVarint(uint64(v.Enum()))
	}
	return tagsize + protowire.SizeBytes(n)
}
func appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
	list := listv.List()
	llen := list.Len()
	if llen == 0 {
		return b, nil
	}
	b = protowire.AppendVarint(b, wiretag)
	n := 0
	for i := 0; i < llen; i++ {
		v := list.Get(i)
		n += protowire.SizeVarint(uint64(v.Enum()))
	}
	b = protowire.AppendVarint(b, uint64(n))
	for i := 0; i < llen; i++ {
		v := list.Get(i)
		b = protowire.AppendVarint(b, uint64(v.Enum()))
	}
	return b, nil
}
var coderEnumPackedSliceValue = valueCoderFuncs{
	size:      sizeEnumPackedSliceValue,
	marshal:   appendEnumPackedSliceValue,
	unmarshal: consumeEnumSliceValue,
	merge:     mergeListValue,
}
func sizeInt32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
	v := *p.Int32()
	return f.tagsize + protowire.SizeVarint(uint64(v))
}
func appendInt32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
	v := *p.Int32()
	b = protowire.AppendVarint(b, f.wiretag)
	b = protowire.AppendVarint(b, uint64(v))
	return b, nil
}