codec_gen.go raw

   1  // Copyright 2018 The Go Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style
   3  // license that can be found in the LICENSE file.
   4  
   5  // Code generated by generate-types. DO NOT EDIT.
   6  
   7  package impl
   8  
   9  import (
  10  	"math"
  11  	"unicode/utf8"
  12  
  13  	"google.golang.org/protobuf/encoding/protowire"
  14  	"google.golang.org/protobuf/reflect/protoreflect"
  15  )
  16  
  17  // sizeBool returns the size of wire encoding a bool pointer as a Bool.
  18  func sizeBool(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
  19  	v := *p.Bool()
  20  	return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
  21  }
  22  
  23  // appendBool wire encodes a bool pointer as a Bool.
  24  func appendBool(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
  25  	v := *p.Bool()
  26  	b = protowire.AppendVarint(b, f.wiretag)
  27  	b = protowire.AppendVarint(b, protowire.EncodeBool(v))
  28  	return b, nil
  29  }
  30  
  31  // consumeBool wire decodes a bool pointer as a Bool.
  32  func consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
  33  	if wtyp != protowire.VarintType {
  34  		return out, errUnknown
  35  	}
  36  	var v uint64
  37  	var n int
  38  	if len(b) >= 1 && b[0] < 0x80 {
  39  		v = uint64(b[0])
  40  		n = 1
  41  	} else if len(b) >= 2 && b[1] < 128 {
  42  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
  43  		n = 2
  44  	} else {
  45  		v, n = protowire.ConsumeVarint(b)
  46  	}
  47  	if n < 0 {
  48  		return out, errDecode
  49  	}
  50  	*p.Bool() = protowire.DecodeBool(v)
  51  	out.n = n
  52  	return out, nil
  53  }
  54  
  55  var coderBool = pointerCoderFuncs{
  56  	size:      sizeBool,
  57  	marshal:   appendBool,
  58  	unmarshal: consumeBool,
  59  	merge:     mergeBool,
  60  }
  61  
  62  // sizeBoolNoZero returns the size of wire encoding a bool pointer as a Bool.
  63  // The zero value is not encoded.
  64  func sizeBoolNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
  65  	v := *p.Bool()
  66  	if v == false {
  67  		return 0
  68  	}
  69  	return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
  70  }
  71  
  72  // appendBoolNoZero wire encodes a bool pointer as a Bool.
  73  // The zero value is not encoded.
  74  func appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
  75  	v := *p.Bool()
  76  	if v == false {
  77  		return b, nil
  78  	}
  79  	b = protowire.AppendVarint(b, f.wiretag)
  80  	b = protowire.AppendVarint(b, protowire.EncodeBool(v))
  81  	return b, nil
  82  }
  83  
  84  var coderBoolNoZero = pointerCoderFuncs{
  85  	size:      sizeBoolNoZero,
  86  	marshal:   appendBoolNoZero,
  87  	unmarshal: consumeBool,
  88  	merge:     mergeBoolNoZero,
  89  }
  90  
  91  // sizeBoolPtr returns the size of wire encoding a *bool pointer as a Bool.
  92  // It panics if the pointer is nil.
  93  func sizeBoolPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
  94  	v := **p.BoolPtr()
  95  	return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
  96  }
  97  
  98  // appendBoolPtr wire encodes a *bool pointer as a Bool.
  99  // It panics if the pointer is nil.
 100  func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
 101  	v := **p.BoolPtr()
 102  	b = protowire.AppendVarint(b, f.wiretag)
 103  	b = protowire.AppendVarint(b, protowire.EncodeBool(v))
 104  	return b, nil
 105  }
 106  
 107  // consumeBoolPtr wire decodes a *bool pointer as a Bool.
 108  func consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
 109  	if wtyp != protowire.VarintType {
 110  		return out, errUnknown
 111  	}
 112  	var v uint64
 113  	var n int
 114  	if len(b) >= 1 && b[0] < 0x80 {
 115  		v = uint64(b[0])
 116  		n = 1
 117  	} else if len(b) >= 2 && b[1] < 128 {
 118  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 119  		n = 2
 120  	} else {
 121  		v, n = protowire.ConsumeVarint(b)
 122  	}
 123  	if n < 0 {
 124  		return out, errDecode
 125  	}
 126  	vp := p.BoolPtr()
 127  	if *vp == nil {
 128  		*vp = new(bool)
 129  	}
 130  	**vp = protowire.DecodeBool(v)
 131  	out.n = n
 132  	return out, nil
 133  }
 134  
 135  var coderBoolPtr = pointerCoderFuncs{
 136  	size:      sizeBoolPtr,
 137  	marshal:   appendBoolPtr,
 138  	unmarshal: consumeBoolPtr,
 139  	merge:     mergeBoolPtr,
 140  }
 141  
 142  // sizeBoolSlice returns the size of wire encoding a []bool pointer as a repeated Bool.
 143  func sizeBoolSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
 144  	s := *p.BoolSlice()
 145  	for _, v := range s {
 146  		size += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
 147  	}
 148  	return size
 149  }
 150  
 151  // appendBoolSlice encodes a []bool pointer as a repeated Bool.
 152  func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
 153  	s := *p.BoolSlice()
 154  	for _, v := range s {
 155  		b = protowire.AppendVarint(b, f.wiretag)
 156  		b = protowire.AppendVarint(b, protowire.EncodeBool(v))
 157  	}
 158  	return b, nil
 159  }
 160  
 161  // consumeBoolSlice wire decodes a []bool pointer as a repeated Bool.
 162  func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
 163  	sp := p.BoolSlice()
 164  	if wtyp == protowire.BytesType {
 165  		b, n := protowire.ConsumeBytes(b)
 166  		if n < 0 {
 167  			return out, errDecode
 168  		}
 169  		count := 0
 170  		for _, v := range b {
 171  			if v < 0x80 {
 172  				count++
 173  			}
 174  		}
 175  		if count > 0 {
 176  			p.growBoolSlice(count)
 177  		}
 178  		s := *sp
 179  		for len(b) > 0 {
 180  			var v uint64
 181  			var n int
 182  			if len(b) >= 1 && b[0] < 0x80 {
 183  				v = uint64(b[0])
 184  				n = 1
 185  			} else if len(b) >= 2 && b[1] < 128 {
 186  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 187  				n = 2
 188  			} else {
 189  				v, n = protowire.ConsumeVarint(b)
 190  			}
 191  			if n < 0 {
 192  				return out, errDecode
 193  			}
 194  			s = append(s, protowire.DecodeBool(v))
 195  			b = b[n:]
 196  		}
 197  		*sp = s
 198  		out.n = n
 199  		return out, nil
 200  	}
 201  	if wtyp != protowire.VarintType {
 202  		return out, errUnknown
 203  	}
 204  	var v uint64
 205  	var n int
 206  	if len(b) >= 1 && b[0] < 0x80 {
 207  		v = uint64(b[0])
 208  		n = 1
 209  	} else if len(b) >= 2 && b[1] < 128 {
 210  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 211  		n = 2
 212  	} else {
 213  		v, n = protowire.ConsumeVarint(b)
 214  	}
 215  	if n < 0 {
 216  		return out, errDecode
 217  	}
 218  	*sp = append(*sp, protowire.DecodeBool(v))
 219  	out.n = n
 220  	return out, nil
 221  }
 222  
 223  var coderBoolSlice = pointerCoderFuncs{
 224  	size:      sizeBoolSlice,
 225  	marshal:   appendBoolSlice,
 226  	unmarshal: consumeBoolSlice,
 227  	merge:     mergeBoolSlice,
 228  }
 229  
 230  // sizeBoolPackedSlice returns the size of wire encoding a []bool pointer as a packed repeated Bool.
 231  func sizeBoolPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
 232  	s := *p.BoolSlice()
 233  	if len(s) == 0 {
 234  		return 0
 235  	}
 236  	n := 0
 237  	for _, v := range s {
 238  		n += protowire.SizeVarint(protowire.EncodeBool(v))
 239  	}
 240  	return f.tagsize + protowire.SizeBytes(n)
 241  }
 242  
 243  // appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool.
 244  func appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
 245  	s := *p.BoolSlice()
 246  	if len(s) == 0 {
 247  		return b, nil
 248  	}
 249  	b = protowire.AppendVarint(b, f.wiretag)
 250  	n := 0
 251  	for _, v := range s {
 252  		n += protowire.SizeVarint(protowire.EncodeBool(v))
 253  	}
 254  	b = protowire.AppendVarint(b, uint64(n))
 255  	for _, v := range s {
 256  		b = protowire.AppendVarint(b, protowire.EncodeBool(v))
 257  	}
 258  	return b, nil
 259  }
 260  
 261  var coderBoolPackedSlice = pointerCoderFuncs{
 262  	size:      sizeBoolPackedSlice,
 263  	marshal:   appendBoolPackedSlice,
 264  	unmarshal: consumeBoolSlice,
 265  	merge:     mergeBoolSlice,
 266  }
 267  
 268  // sizeBoolValue returns the size of wire encoding a bool value as a Bool.
 269  func sizeBoolValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
 270  	return tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
 271  }
 272  
 273  // appendBoolValue encodes a bool value as a Bool.
 274  func appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 275  	b = protowire.AppendVarint(b, wiretag)
 276  	b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
 277  	return b, nil
 278  }
 279  
 280  // consumeBoolValue decodes a bool value as a Bool.
 281  func consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
 282  	if wtyp != protowire.VarintType {
 283  		return protoreflect.Value{}, out, errUnknown
 284  	}
 285  	var v uint64
 286  	var n int
 287  	if len(b) >= 1 && b[0] < 0x80 {
 288  		v = uint64(b[0])
 289  		n = 1
 290  	} else if len(b) >= 2 && b[1] < 128 {
 291  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 292  		n = 2
 293  	} else {
 294  		v, n = protowire.ConsumeVarint(b)
 295  	}
 296  	if n < 0 {
 297  		return protoreflect.Value{}, out, errDecode
 298  	}
 299  	out.n = n
 300  	return protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil
 301  }
 302  
 303  var coderBoolValue = valueCoderFuncs{
 304  	size:      sizeBoolValue,
 305  	marshal:   appendBoolValue,
 306  	unmarshal: consumeBoolValue,
 307  	merge:     mergeScalarValue,
 308  }
 309  
 310  // sizeBoolSliceValue returns the size of wire encoding a []bool value as a repeated Bool.
 311  func sizeBoolSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
 312  	list := listv.List()
 313  	for i, llen := 0, list.Len(); i < llen; i++ {
 314  		v := list.Get(i)
 315  		size += tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
 316  	}
 317  	return size
 318  }
 319  
 320  // appendBoolSliceValue encodes a []bool value as a repeated Bool.
 321  func appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 322  	list := listv.List()
 323  	for i, llen := 0, list.Len(); i < llen; i++ {
 324  		v := list.Get(i)
 325  		b = protowire.AppendVarint(b, wiretag)
 326  		b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
 327  	}
 328  	return b, nil
 329  }
 330  
 331  // consumeBoolSliceValue wire decodes a []bool value as a repeated Bool.
 332  func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
 333  	list := listv.List()
 334  	if wtyp == protowire.BytesType {
 335  		b, n := protowire.ConsumeBytes(b)
 336  		if n < 0 {
 337  			return protoreflect.Value{}, out, errDecode
 338  		}
 339  		for len(b) > 0 {
 340  			var v uint64
 341  			var n int
 342  			if len(b) >= 1 && b[0] < 0x80 {
 343  				v = uint64(b[0])
 344  				n = 1
 345  			} else if len(b) >= 2 && b[1] < 128 {
 346  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 347  				n = 2
 348  			} else {
 349  				v, n = protowire.ConsumeVarint(b)
 350  			}
 351  			if n < 0 {
 352  				return protoreflect.Value{}, out, errDecode
 353  			}
 354  			list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
 355  			b = b[n:]
 356  		}
 357  		out.n = n
 358  		return listv, out, nil
 359  	}
 360  	if wtyp != protowire.VarintType {
 361  		return protoreflect.Value{}, out, errUnknown
 362  	}
 363  	var v uint64
 364  	var n int
 365  	if len(b) >= 1 && b[0] < 0x80 {
 366  		v = uint64(b[0])
 367  		n = 1
 368  	} else if len(b) >= 2 && b[1] < 128 {
 369  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 370  		n = 2
 371  	} else {
 372  		v, n = protowire.ConsumeVarint(b)
 373  	}
 374  	if n < 0 {
 375  		return protoreflect.Value{}, out, errDecode
 376  	}
 377  	list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
 378  	out.n = n
 379  	return listv, out, nil
 380  }
 381  
 382  var coderBoolSliceValue = valueCoderFuncs{
 383  	size:      sizeBoolSliceValue,
 384  	marshal:   appendBoolSliceValue,
 385  	unmarshal: consumeBoolSliceValue,
 386  	merge:     mergeListValue,
 387  }
 388  
 389  // sizeBoolPackedSliceValue returns the size of wire encoding a []bool value as a packed repeated Bool.
 390  func sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
 391  	list := listv.List()
 392  	llen := list.Len()
 393  	if llen == 0 {
 394  		return 0
 395  	}
 396  	n := 0
 397  	for i, llen := 0, llen; i < llen; i++ {
 398  		v := list.Get(i)
 399  		n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
 400  	}
 401  	return tagsize + protowire.SizeBytes(n)
 402  }
 403  
 404  // appendBoolPackedSliceValue encodes a []bool value as a packed repeated Bool.
 405  func appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 406  	list := listv.List()
 407  	llen := list.Len()
 408  	if llen == 0 {
 409  		return b, nil
 410  	}
 411  	b = protowire.AppendVarint(b, wiretag)
 412  	n := 0
 413  	for i := 0; i < llen; i++ {
 414  		v := list.Get(i)
 415  		n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
 416  	}
 417  	b = protowire.AppendVarint(b, uint64(n))
 418  	for i := 0; i < llen; i++ {
 419  		v := list.Get(i)
 420  		b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
 421  	}
 422  	return b, nil
 423  }
 424  
 425  var coderBoolPackedSliceValue = valueCoderFuncs{
 426  	size:      sizeBoolPackedSliceValue,
 427  	marshal:   appendBoolPackedSliceValue,
 428  	unmarshal: consumeBoolSliceValue,
 429  	merge:     mergeListValue,
 430  }
 431  
 432  // sizeEnumValue returns the size of wire encoding a  value as a Enum.
 433  func sizeEnumValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
 434  	return tagsize + protowire.SizeVarint(uint64(v.Enum()))
 435  }
 436  
 437  // appendEnumValue encodes a  value as a Enum.
 438  func appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 439  	b = protowire.AppendVarint(b, wiretag)
 440  	b = protowire.AppendVarint(b, uint64(v.Enum()))
 441  	return b, nil
 442  }
 443  
 444  // consumeEnumValue decodes a  value as a Enum.
 445  func consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
 446  	if wtyp != protowire.VarintType {
 447  		return protoreflect.Value{}, out, errUnknown
 448  	}
 449  	var v uint64
 450  	var n int
 451  	if len(b) >= 1 && b[0] < 0x80 {
 452  		v = uint64(b[0])
 453  		n = 1
 454  	} else if len(b) >= 2 && b[1] < 128 {
 455  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 456  		n = 2
 457  	} else {
 458  		v, n = protowire.ConsumeVarint(b)
 459  	}
 460  	if n < 0 {
 461  		return protoreflect.Value{}, out, errDecode
 462  	}
 463  	out.n = n
 464  	return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil
 465  }
 466  
 467  var coderEnumValue = valueCoderFuncs{
 468  	size:      sizeEnumValue,
 469  	marshal:   appendEnumValue,
 470  	unmarshal: consumeEnumValue,
 471  	merge:     mergeScalarValue,
 472  }
 473  
 474  // sizeEnumSliceValue returns the size of wire encoding a [] value as a repeated Enum.
 475  func sizeEnumSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
 476  	list := listv.List()
 477  	for i, llen := 0, list.Len(); i < llen; i++ {
 478  		v := list.Get(i)
 479  		size += tagsize + protowire.SizeVarint(uint64(v.Enum()))
 480  	}
 481  	return size
 482  }
 483  
 484  // appendEnumSliceValue encodes a [] value as a repeated Enum.
 485  func appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 486  	list := listv.List()
 487  	for i, llen := 0, list.Len(); i < llen; i++ {
 488  		v := list.Get(i)
 489  		b = protowire.AppendVarint(b, wiretag)
 490  		b = protowire.AppendVarint(b, uint64(v.Enum()))
 491  	}
 492  	return b, nil
 493  }
 494  
 495  // consumeEnumSliceValue wire decodes a [] value as a repeated Enum.
 496  func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
 497  	list := listv.List()
 498  	if wtyp == protowire.BytesType {
 499  		b, n := protowire.ConsumeBytes(b)
 500  		if n < 0 {
 501  			return protoreflect.Value{}, out, errDecode
 502  		}
 503  		for len(b) > 0 {
 504  			var v uint64
 505  			var n int
 506  			if len(b) >= 1 && b[0] < 0x80 {
 507  				v = uint64(b[0])
 508  				n = 1
 509  			} else if len(b) >= 2 && b[1] < 128 {
 510  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 511  				n = 2
 512  			} else {
 513  				v, n = protowire.ConsumeVarint(b)
 514  			}
 515  			if n < 0 {
 516  				return protoreflect.Value{}, out, errDecode
 517  			}
 518  			list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
 519  			b = b[n:]
 520  		}
 521  		out.n = n
 522  		return listv, out, nil
 523  	}
 524  	if wtyp != protowire.VarintType {
 525  		return protoreflect.Value{}, out, errUnknown
 526  	}
 527  	var v uint64
 528  	var n int
 529  	if len(b) >= 1 && b[0] < 0x80 {
 530  		v = uint64(b[0])
 531  		n = 1
 532  	} else if len(b) >= 2 && b[1] < 128 {
 533  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 534  		n = 2
 535  	} else {
 536  		v, n = protowire.ConsumeVarint(b)
 537  	}
 538  	if n < 0 {
 539  		return protoreflect.Value{}, out, errDecode
 540  	}
 541  	list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
 542  	out.n = n
 543  	return listv, out, nil
 544  }
 545  
 546  var coderEnumSliceValue = valueCoderFuncs{
 547  	size:      sizeEnumSliceValue,
 548  	marshal:   appendEnumSliceValue,
 549  	unmarshal: consumeEnumSliceValue,
 550  	merge:     mergeListValue,
 551  }
 552  
 553  // sizeEnumPackedSliceValue returns the size of wire encoding a [] value as a packed repeated Enum.
 554  func sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
 555  	list := listv.List()
 556  	llen := list.Len()
 557  	if llen == 0 {
 558  		return 0
 559  	}
 560  	n := 0
 561  	for i, llen := 0, llen; i < llen; i++ {
 562  		v := list.Get(i)
 563  		n += protowire.SizeVarint(uint64(v.Enum()))
 564  	}
 565  	return tagsize + protowire.SizeBytes(n)
 566  }
 567  
 568  // appendEnumPackedSliceValue encodes a [] value as a packed repeated Enum.
 569  func appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 570  	list := listv.List()
 571  	llen := list.Len()
 572  	if llen == 0 {
 573  		return b, nil
 574  	}
 575  	b = protowire.AppendVarint(b, wiretag)
 576  	n := 0
 577  	for i := 0; i < llen; i++ {
 578  		v := list.Get(i)
 579  		n += protowire.SizeVarint(uint64(v.Enum()))
 580  	}
 581  	b = protowire.AppendVarint(b, uint64(n))
 582  	for i := 0; i < llen; i++ {
 583  		v := list.Get(i)
 584  		b = protowire.AppendVarint(b, uint64(v.Enum()))
 585  	}
 586  	return b, nil
 587  }
 588  
 589  var coderEnumPackedSliceValue = valueCoderFuncs{
 590  	size:      sizeEnumPackedSliceValue,
 591  	marshal:   appendEnumPackedSliceValue,
 592  	unmarshal: consumeEnumSliceValue,
 593  	merge:     mergeListValue,
 594  }
 595  
 596  // sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.
 597  func sizeInt32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
 598  	v := *p.Int32()
 599  	return f.tagsize + protowire.SizeVarint(uint64(v))
 600  }
 601  
 602  // appendInt32 wire encodes a int32 pointer as a Int32.
 603  func appendInt32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
 604  	v := *p.Int32()
 605  	b = protowire.AppendVarint(b, f.wiretag)
 606  	b = protowire.AppendVarint(b, uint64(v))
 607  	return b, nil
 608  }
 609  
 610  // consumeInt32 wire decodes a int32 pointer as a Int32.
 611  func consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
 612  	if wtyp != protowire.VarintType {
 613  		return out, errUnknown
 614  	}
 615  	var v uint64
 616  	var n int
 617  	if len(b) >= 1 && b[0] < 0x80 {
 618  		v = uint64(b[0])
 619  		n = 1
 620  	} else if len(b) >= 2 && b[1] < 128 {
 621  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 622  		n = 2
 623  	} else {
 624  		v, n = protowire.ConsumeVarint(b)
 625  	}
 626  	if n < 0 {
 627  		return out, errDecode
 628  	}
 629  	*p.Int32() = int32(v)
 630  	out.n = n
 631  	return out, nil
 632  }
 633  
 634  var coderInt32 = pointerCoderFuncs{
 635  	size:      sizeInt32,
 636  	marshal:   appendInt32,
 637  	unmarshal: consumeInt32,
 638  	merge:     mergeInt32,
 639  }
 640  
 641  // sizeInt32NoZero returns the size of wire encoding a int32 pointer as a Int32.
 642  // The zero value is not encoded.
 643  func sizeInt32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
 644  	v := *p.Int32()
 645  	if v == 0 {
 646  		return 0
 647  	}
 648  	return f.tagsize + protowire.SizeVarint(uint64(v))
 649  }
 650  
 651  // appendInt32NoZero wire encodes a int32 pointer as a Int32.
 652  // The zero value is not encoded.
 653  func appendInt32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
 654  	v := *p.Int32()
 655  	if v == 0 {
 656  		return b, nil
 657  	}
 658  	b = protowire.AppendVarint(b, f.wiretag)
 659  	b = protowire.AppendVarint(b, uint64(v))
 660  	return b, nil
 661  }
 662  
 663  var coderInt32NoZero = pointerCoderFuncs{
 664  	size:      sizeInt32NoZero,
 665  	marshal:   appendInt32NoZero,
 666  	unmarshal: consumeInt32,
 667  	merge:     mergeInt32NoZero,
 668  }
 669  
 670  // sizeInt32Ptr returns the size of wire encoding a *int32 pointer as a Int32.
 671  // It panics if the pointer is nil.
 672  func sizeInt32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
 673  	v := **p.Int32Ptr()
 674  	return f.tagsize + protowire.SizeVarint(uint64(v))
 675  }
 676  
 677  // appendInt32Ptr wire encodes a *int32 pointer as a Int32.
 678  // It panics if the pointer is nil.
 679  func appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
 680  	v := **p.Int32Ptr()
 681  	b = protowire.AppendVarint(b, f.wiretag)
 682  	b = protowire.AppendVarint(b, uint64(v))
 683  	return b, nil
 684  }
 685  
 686  // consumeInt32Ptr wire decodes a *int32 pointer as a Int32.
 687  func consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
 688  	if wtyp != protowire.VarintType {
 689  		return out, errUnknown
 690  	}
 691  	var v uint64
 692  	var n int
 693  	if len(b) >= 1 && b[0] < 0x80 {
 694  		v = uint64(b[0])
 695  		n = 1
 696  	} else if len(b) >= 2 && b[1] < 128 {
 697  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 698  		n = 2
 699  	} else {
 700  		v, n = protowire.ConsumeVarint(b)
 701  	}
 702  	if n < 0 {
 703  		return out, errDecode
 704  	}
 705  	vp := p.Int32Ptr()
 706  	if *vp == nil {
 707  		*vp = new(int32)
 708  	}
 709  	**vp = int32(v)
 710  	out.n = n
 711  	return out, nil
 712  }
 713  
 714  var coderInt32Ptr = pointerCoderFuncs{
 715  	size:      sizeInt32Ptr,
 716  	marshal:   appendInt32Ptr,
 717  	unmarshal: consumeInt32Ptr,
 718  	merge:     mergeInt32Ptr,
 719  }
 720  
 721  // sizeInt32Slice returns the size of wire encoding a []int32 pointer as a repeated Int32.
 722  func sizeInt32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
 723  	s := *p.Int32Slice()
 724  	for _, v := range s {
 725  		size += f.tagsize + protowire.SizeVarint(uint64(v))
 726  	}
 727  	return size
 728  }
 729  
 730  // appendInt32Slice encodes a []int32 pointer as a repeated Int32.
 731  func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
 732  	s := *p.Int32Slice()
 733  	for _, v := range s {
 734  		b = protowire.AppendVarint(b, f.wiretag)
 735  		b = protowire.AppendVarint(b, uint64(v))
 736  	}
 737  	return b, nil
 738  }
 739  
 740  // consumeInt32Slice wire decodes a []int32 pointer as a repeated Int32.
 741  func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
 742  	sp := p.Int32Slice()
 743  	if wtyp == protowire.BytesType {
 744  		b, n := protowire.ConsumeBytes(b)
 745  		if n < 0 {
 746  			return out, errDecode
 747  		}
 748  		count := 0
 749  		for _, v := range b {
 750  			if v < 0x80 {
 751  				count++
 752  			}
 753  		}
 754  		if count > 0 {
 755  			p.growInt32Slice(count)
 756  		}
 757  		s := *sp
 758  		for len(b) > 0 {
 759  			var v uint64
 760  			var n int
 761  			if len(b) >= 1 && b[0] < 0x80 {
 762  				v = uint64(b[0])
 763  				n = 1
 764  			} else if len(b) >= 2 && b[1] < 128 {
 765  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 766  				n = 2
 767  			} else {
 768  				v, n = protowire.ConsumeVarint(b)
 769  			}
 770  			if n < 0 {
 771  				return out, errDecode
 772  			}
 773  			s = append(s, int32(v))
 774  			b = b[n:]
 775  		}
 776  		*sp = s
 777  		out.n = n
 778  		return out, nil
 779  	}
 780  	if wtyp != protowire.VarintType {
 781  		return out, errUnknown
 782  	}
 783  	var v uint64
 784  	var n int
 785  	if len(b) >= 1 && b[0] < 0x80 {
 786  		v = uint64(b[0])
 787  		n = 1
 788  	} else if len(b) >= 2 && b[1] < 128 {
 789  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 790  		n = 2
 791  	} else {
 792  		v, n = protowire.ConsumeVarint(b)
 793  	}
 794  	if n < 0 {
 795  		return out, errDecode
 796  	}
 797  	*sp = append(*sp, int32(v))
 798  	out.n = n
 799  	return out, nil
 800  }
 801  
 802  var coderInt32Slice = pointerCoderFuncs{
 803  	size:      sizeInt32Slice,
 804  	marshal:   appendInt32Slice,
 805  	unmarshal: consumeInt32Slice,
 806  	merge:     mergeInt32Slice,
 807  }
 808  
 809  // sizeInt32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Int32.
 810  func sizeInt32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
 811  	s := *p.Int32Slice()
 812  	if len(s) == 0 {
 813  		return 0
 814  	}
 815  	n := 0
 816  	for _, v := range s {
 817  		n += protowire.SizeVarint(uint64(v))
 818  	}
 819  	return f.tagsize + protowire.SizeBytes(n)
 820  }
 821  
 822  // appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32.
 823  func appendInt32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
 824  	s := *p.Int32Slice()
 825  	if len(s) == 0 {
 826  		return b, nil
 827  	}
 828  	b = protowire.AppendVarint(b, f.wiretag)
 829  	n := 0
 830  	for _, v := range s {
 831  		n += protowire.SizeVarint(uint64(v))
 832  	}
 833  	b = protowire.AppendVarint(b, uint64(n))
 834  	for _, v := range s {
 835  		b = protowire.AppendVarint(b, uint64(v))
 836  	}
 837  	return b, nil
 838  }
 839  
 840  var coderInt32PackedSlice = pointerCoderFuncs{
 841  	size:      sizeInt32PackedSlice,
 842  	marshal:   appendInt32PackedSlice,
 843  	unmarshal: consumeInt32Slice,
 844  	merge:     mergeInt32Slice,
 845  }
 846  
 847  // sizeInt32Value returns the size of wire encoding a int32 value as a Int32.
 848  func sizeInt32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
 849  	return tagsize + protowire.SizeVarint(uint64(int32(v.Int())))
 850  }
 851  
 852  // appendInt32Value encodes a int32 value as a Int32.
 853  func appendInt32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 854  	b = protowire.AppendVarint(b, wiretag)
 855  	b = protowire.AppendVarint(b, uint64(int32(v.Int())))
 856  	return b, nil
 857  }
 858  
 859  // consumeInt32Value decodes a int32 value as a Int32.
 860  func consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
 861  	if wtyp != protowire.VarintType {
 862  		return protoreflect.Value{}, out, errUnknown
 863  	}
 864  	var v uint64
 865  	var n int
 866  	if len(b) >= 1 && b[0] < 0x80 {
 867  		v = uint64(b[0])
 868  		n = 1
 869  	} else if len(b) >= 2 && b[1] < 128 {
 870  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 871  		n = 2
 872  	} else {
 873  		v, n = protowire.ConsumeVarint(b)
 874  	}
 875  	if n < 0 {
 876  		return protoreflect.Value{}, out, errDecode
 877  	}
 878  	out.n = n
 879  	return protoreflect.ValueOfInt32(int32(v)), out, nil
 880  }
 881  
 882  var coderInt32Value = valueCoderFuncs{
 883  	size:      sizeInt32Value,
 884  	marshal:   appendInt32Value,
 885  	unmarshal: consumeInt32Value,
 886  	merge:     mergeScalarValue,
 887  }
 888  
 889  // sizeInt32SliceValue returns the size of wire encoding a []int32 value as a repeated Int32.
 890  func sizeInt32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
 891  	list := listv.List()
 892  	for i, llen := 0, list.Len(); i < llen; i++ {
 893  		v := list.Get(i)
 894  		size += tagsize + protowire.SizeVarint(uint64(int32(v.Int())))
 895  	}
 896  	return size
 897  }
 898  
 899  // appendInt32SliceValue encodes a []int32 value as a repeated Int32.
 900  func appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 901  	list := listv.List()
 902  	for i, llen := 0, list.Len(); i < llen; i++ {
 903  		v := list.Get(i)
 904  		b = protowire.AppendVarint(b, wiretag)
 905  		b = protowire.AppendVarint(b, uint64(int32(v.Int())))
 906  	}
 907  	return b, nil
 908  }
 909  
 910  // consumeInt32SliceValue wire decodes a []int32 value as a repeated Int32.
 911  func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
 912  	list := listv.List()
 913  	if wtyp == protowire.BytesType {
 914  		b, n := protowire.ConsumeBytes(b)
 915  		if n < 0 {
 916  			return protoreflect.Value{}, out, errDecode
 917  		}
 918  		for len(b) > 0 {
 919  			var v uint64
 920  			var n int
 921  			if len(b) >= 1 && b[0] < 0x80 {
 922  				v = uint64(b[0])
 923  				n = 1
 924  			} else if len(b) >= 2 && b[1] < 128 {
 925  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 926  				n = 2
 927  			} else {
 928  				v, n = protowire.ConsumeVarint(b)
 929  			}
 930  			if n < 0 {
 931  				return protoreflect.Value{}, out, errDecode
 932  			}
 933  			list.Append(protoreflect.ValueOfInt32(int32(v)))
 934  			b = b[n:]
 935  		}
 936  		out.n = n
 937  		return listv, out, nil
 938  	}
 939  	if wtyp != protowire.VarintType {
 940  		return protoreflect.Value{}, out, errUnknown
 941  	}
 942  	var v uint64
 943  	var n int
 944  	if len(b) >= 1 && b[0] < 0x80 {
 945  		v = uint64(b[0])
 946  		n = 1
 947  	} else if len(b) >= 2 && b[1] < 128 {
 948  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
 949  		n = 2
 950  	} else {
 951  		v, n = protowire.ConsumeVarint(b)
 952  	}
 953  	if n < 0 {
 954  		return protoreflect.Value{}, out, errDecode
 955  	}
 956  	list.Append(protoreflect.ValueOfInt32(int32(v)))
 957  	out.n = n
 958  	return listv, out, nil
 959  }
 960  
 961  var coderInt32SliceValue = valueCoderFuncs{
 962  	size:      sizeInt32SliceValue,
 963  	marshal:   appendInt32SliceValue,
 964  	unmarshal: consumeInt32SliceValue,
 965  	merge:     mergeListValue,
 966  }
 967  
 968  // sizeInt32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Int32.
 969  func sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
 970  	list := listv.List()
 971  	llen := list.Len()
 972  	if llen == 0 {
 973  		return 0
 974  	}
 975  	n := 0
 976  	for i, llen := 0, llen; i < llen; i++ {
 977  		v := list.Get(i)
 978  		n += protowire.SizeVarint(uint64(int32(v.Int())))
 979  	}
 980  	return tagsize + protowire.SizeBytes(n)
 981  }
 982  
 983  // appendInt32PackedSliceValue encodes a []int32 value as a packed repeated Int32.
 984  func appendInt32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
 985  	list := listv.List()
 986  	llen := list.Len()
 987  	if llen == 0 {
 988  		return b, nil
 989  	}
 990  	b = protowire.AppendVarint(b, wiretag)
 991  	n := 0
 992  	for i := 0; i < llen; i++ {
 993  		v := list.Get(i)
 994  		n += protowire.SizeVarint(uint64(int32(v.Int())))
 995  	}
 996  	b = protowire.AppendVarint(b, uint64(n))
 997  	for i := 0; i < llen; i++ {
 998  		v := list.Get(i)
 999  		b = protowire.AppendVarint(b, uint64(int32(v.Int())))
1000  	}
1001  	return b, nil
1002  }
1003  
1004  var coderInt32PackedSliceValue = valueCoderFuncs{
1005  	size:      sizeInt32PackedSliceValue,
1006  	marshal:   appendInt32PackedSliceValue,
1007  	unmarshal: consumeInt32SliceValue,
1008  	merge:     mergeListValue,
1009  }
1010  
1011  // sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.
1012  func sizeSint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1013  	v := *p.Int32()
1014  	return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1015  }
1016  
1017  // appendSint32 wire encodes a int32 pointer as a Sint32.
1018  func appendSint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1019  	v := *p.Int32()
1020  	b = protowire.AppendVarint(b, f.wiretag)
1021  	b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
1022  	return b, nil
1023  }
1024  
1025  // consumeSint32 wire decodes a int32 pointer as a Sint32.
1026  func consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1027  	if wtyp != protowire.VarintType {
1028  		return out, errUnknown
1029  	}
1030  	var v uint64
1031  	var n int
1032  	if len(b) >= 1 && b[0] < 0x80 {
1033  		v = uint64(b[0])
1034  		n = 1
1035  	} else if len(b) >= 2 && b[1] < 128 {
1036  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1037  		n = 2
1038  	} else {
1039  		v, n = protowire.ConsumeVarint(b)
1040  	}
1041  	if n < 0 {
1042  		return out, errDecode
1043  	}
1044  	*p.Int32() = int32(protowire.DecodeZigZag(v & math.MaxUint32))
1045  	out.n = n
1046  	return out, nil
1047  }
1048  
1049  var coderSint32 = pointerCoderFuncs{
1050  	size:      sizeSint32,
1051  	marshal:   appendSint32,
1052  	unmarshal: consumeSint32,
1053  	merge:     mergeInt32,
1054  }
1055  
1056  // sizeSint32NoZero returns the size of wire encoding a int32 pointer as a Sint32.
1057  // The zero value is not encoded.
1058  func sizeSint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1059  	v := *p.Int32()
1060  	if v == 0 {
1061  		return 0
1062  	}
1063  	return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1064  }
1065  
1066  // appendSint32NoZero wire encodes a int32 pointer as a Sint32.
1067  // The zero value is not encoded.
1068  func appendSint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1069  	v := *p.Int32()
1070  	if v == 0 {
1071  		return b, nil
1072  	}
1073  	b = protowire.AppendVarint(b, f.wiretag)
1074  	b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
1075  	return b, nil
1076  }
1077  
1078  var coderSint32NoZero = pointerCoderFuncs{
1079  	size:      sizeSint32NoZero,
1080  	marshal:   appendSint32NoZero,
1081  	unmarshal: consumeSint32,
1082  	merge:     mergeInt32NoZero,
1083  }
1084  
1085  // sizeSint32Ptr returns the size of wire encoding a *int32 pointer as a Sint32.
1086  // It panics if the pointer is nil.
1087  func sizeSint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1088  	v := **p.Int32Ptr()
1089  	return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1090  }
1091  
1092  // appendSint32Ptr wire encodes a *int32 pointer as a Sint32.
1093  // It panics if the pointer is nil.
1094  func appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1095  	v := **p.Int32Ptr()
1096  	b = protowire.AppendVarint(b, f.wiretag)
1097  	b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
1098  	return b, nil
1099  }
1100  
1101  // consumeSint32Ptr wire decodes a *int32 pointer as a Sint32.
1102  func consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1103  	if wtyp != protowire.VarintType {
1104  		return out, errUnknown
1105  	}
1106  	var v uint64
1107  	var n int
1108  	if len(b) >= 1 && b[0] < 0x80 {
1109  		v = uint64(b[0])
1110  		n = 1
1111  	} else if len(b) >= 2 && b[1] < 128 {
1112  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1113  		n = 2
1114  	} else {
1115  		v, n = protowire.ConsumeVarint(b)
1116  	}
1117  	if n < 0 {
1118  		return out, errDecode
1119  	}
1120  	vp := p.Int32Ptr()
1121  	if *vp == nil {
1122  		*vp = new(int32)
1123  	}
1124  	**vp = int32(protowire.DecodeZigZag(v & math.MaxUint32))
1125  	out.n = n
1126  	return out, nil
1127  }
1128  
1129  var coderSint32Ptr = pointerCoderFuncs{
1130  	size:      sizeSint32Ptr,
1131  	marshal:   appendSint32Ptr,
1132  	unmarshal: consumeSint32Ptr,
1133  	merge:     mergeInt32Ptr,
1134  }
1135  
1136  // sizeSint32Slice returns the size of wire encoding a []int32 pointer as a repeated Sint32.
1137  func sizeSint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1138  	s := *p.Int32Slice()
1139  	for _, v := range s {
1140  		size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1141  	}
1142  	return size
1143  }
1144  
1145  // appendSint32Slice encodes a []int32 pointer as a repeated Sint32.
1146  func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1147  	s := *p.Int32Slice()
1148  	for _, v := range s {
1149  		b = protowire.AppendVarint(b, f.wiretag)
1150  		b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
1151  	}
1152  	return b, nil
1153  }
1154  
1155  // consumeSint32Slice wire decodes a []int32 pointer as a repeated Sint32.
1156  func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1157  	sp := p.Int32Slice()
1158  	if wtyp == protowire.BytesType {
1159  		b, n := protowire.ConsumeBytes(b)
1160  		if n < 0 {
1161  			return out, errDecode
1162  		}
1163  		count := 0
1164  		for _, v := range b {
1165  			if v < 0x80 {
1166  				count++
1167  			}
1168  		}
1169  		if count > 0 {
1170  			p.growInt32Slice(count)
1171  		}
1172  		s := *sp
1173  		for len(b) > 0 {
1174  			var v uint64
1175  			var n int
1176  			if len(b) >= 1 && b[0] < 0x80 {
1177  				v = uint64(b[0])
1178  				n = 1
1179  			} else if len(b) >= 2 && b[1] < 128 {
1180  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1181  				n = 2
1182  			} else {
1183  				v, n = protowire.ConsumeVarint(b)
1184  			}
1185  			if n < 0 {
1186  				return out, errDecode
1187  			}
1188  			s = append(s, int32(protowire.DecodeZigZag(v&math.MaxUint32)))
1189  			b = b[n:]
1190  		}
1191  		*sp = s
1192  		out.n = n
1193  		return out, nil
1194  	}
1195  	if wtyp != protowire.VarintType {
1196  		return out, errUnknown
1197  	}
1198  	var v uint64
1199  	var n int
1200  	if len(b) >= 1 && b[0] < 0x80 {
1201  		v = uint64(b[0])
1202  		n = 1
1203  	} else if len(b) >= 2 && b[1] < 128 {
1204  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1205  		n = 2
1206  	} else {
1207  		v, n = protowire.ConsumeVarint(b)
1208  	}
1209  	if n < 0 {
1210  		return out, errDecode
1211  	}
1212  	*sp = append(*sp, int32(protowire.DecodeZigZag(v&math.MaxUint32)))
1213  	out.n = n
1214  	return out, nil
1215  }
1216  
1217  var coderSint32Slice = pointerCoderFuncs{
1218  	size:      sizeSint32Slice,
1219  	marshal:   appendSint32Slice,
1220  	unmarshal: consumeSint32Slice,
1221  	merge:     mergeInt32Slice,
1222  }
1223  
1224  // sizeSint32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sint32.
1225  func sizeSint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1226  	s := *p.Int32Slice()
1227  	if len(s) == 0 {
1228  		return 0
1229  	}
1230  	n := 0
1231  	for _, v := range s {
1232  		n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1233  	}
1234  	return f.tagsize + protowire.SizeBytes(n)
1235  }
1236  
1237  // appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32.
1238  func appendSint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1239  	s := *p.Int32Slice()
1240  	if len(s) == 0 {
1241  		return b, nil
1242  	}
1243  	b = protowire.AppendVarint(b, f.wiretag)
1244  	n := 0
1245  	for _, v := range s {
1246  		n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1247  	}
1248  	b = protowire.AppendVarint(b, uint64(n))
1249  	for _, v := range s {
1250  		b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
1251  	}
1252  	return b, nil
1253  }
1254  
1255  var coderSint32PackedSlice = pointerCoderFuncs{
1256  	size:      sizeSint32PackedSlice,
1257  	marshal:   appendSint32PackedSlice,
1258  	unmarshal: consumeSint32Slice,
1259  	merge:     mergeInt32Slice,
1260  }
1261  
1262  // sizeSint32Value returns the size of wire encoding a int32 value as a Sint32.
1263  func sizeSint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
1264  	return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
1265  }
1266  
1267  // appendSint32Value encodes a int32 value as a Sint32.
1268  func appendSint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
1269  	b = protowire.AppendVarint(b, wiretag)
1270  	b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
1271  	return b, nil
1272  }
1273  
1274  // consumeSint32Value decodes a int32 value as a Sint32.
1275  func consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
1276  	if wtyp != protowire.VarintType {
1277  		return protoreflect.Value{}, out, errUnknown
1278  	}
1279  	var v uint64
1280  	var n int
1281  	if len(b) >= 1 && b[0] < 0x80 {
1282  		v = uint64(b[0])
1283  		n = 1
1284  	} else if len(b) >= 2 && b[1] < 128 {
1285  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1286  		n = 2
1287  	} else {
1288  		v, n = protowire.ConsumeVarint(b)
1289  	}
1290  	if n < 0 {
1291  		return protoreflect.Value{}, out, errDecode
1292  	}
1293  	out.n = n
1294  	return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), out, nil
1295  }
1296  
1297  var coderSint32Value = valueCoderFuncs{
1298  	size:      sizeSint32Value,
1299  	marshal:   appendSint32Value,
1300  	unmarshal: consumeSint32Value,
1301  	merge:     mergeScalarValue,
1302  }
1303  
1304  // sizeSint32SliceValue returns the size of wire encoding a []int32 value as a repeated Sint32.
1305  func sizeSint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
1306  	list := listv.List()
1307  	for i, llen := 0, list.Len(); i < llen; i++ {
1308  		v := list.Get(i)
1309  		size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
1310  	}
1311  	return size
1312  }
1313  
1314  // appendSint32SliceValue encodes a []int32 value as a repeated Sint32.
1315  func appendSint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
1316  	list := listv.List()
1317  	for i, llen := 0, list.Len(); i < llen; i++ {
1318  		v := list.Get(i)
1319  		b = protowire.AppendVarint(b, wiretag)
1320  		b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
1321  	}
1322  	return b, nil
1323  }
1324  
1325  // consumeSint32SliceValue wire decodes a []int32 value as a repeated Sint32.
1326  func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
1327  	list := listv.List()
1328  	if wtyp == protowire.BytesType {
1329  		b, n := protowire.ConsumeBytes(b)
1330  		if n < 0 {
1331  			return protoreflect.Value{}, out, errDecode
1332  		}
1333  		for len(b) > 0 {
1334  			var v uint64
1335  			var n int
1336  			if len(b) >= 1 && b[0] < 0x80 {
1337  				v = uint64(b[0])
1338  				n = 1
1339  			} else if len(b) >= 2 && b[1] < 128 {
1340  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1341  				n = 2
1342  			} else {
1343  				v, n = protowire.ConsumeVarint(b)
1344  			}
1345  			if n < 0 {
1346  				return protoreflect.Value{}, out, errDecode
1347  			}
1348  			list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
1349  			b = b[n:]
1350  		}
1351  		out.n = n
1352  		return listv, out, nil
1353  	}
1354  	if wtyp != protowire.VarintType {
1355  		return protoreflect.Value{}, out, errUnknown
1356  	}
1357  	var v uint64
1358  	var n int
1359  	if len(b) >= 1 && b[0] < 0x80 {
1360  		v = uint64(b[0])
1361  		n = 1
1362  	} else if len(b) >= 2 && b[1] < 128 {
1363  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1364  		n = 2
1365  	} else {
1366  		v, n = protowire.ConsumeVarint(b)
1367  	}
1368  	if n < 0 {
1369  		return protoreflect.Value{}, out, errDecode
1370  	}
1371  	list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
1372  	out.n = n
1373  	return listv, out, nil
1374  }
1375  
1376  var coderSint32SliceValue = valueCoderFuncs{
1377  	size:      sizeSint32SliceValue,
1378  	marshal:   appendSint32SliceValue,
1379  	unmarshal: consumeSint32SliceValue,
1380  	merge:     mergeListValue,
1381  }
1382  
1383  // sizeSint32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sint32.
1384  func sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
1385  	list := listv.List()
1386  	llen := list.Len()
1387  	if llen == 0 {
1388  		return 0
1389  	}
1390  	n := 0
1391  	for i, llen := 0, llen; i < llen; i++ {
1392  		v := list.Get(i)
1393  		n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
1394  	}
1395  	return tagsize + protowire.SizeBytes(n)
1396  }
1397  
1398  // appendSint32PackedSliceValue encodes a []int32 value as a packed repeated Sint32.
1399  func appendSint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
1400  	list := listv.List()
1401  	llen := list.Len()
1402  	if llen == 0 {
1403  		return b, nil
1404  	}
1405  	b = protowire.AppendVarint(b, wiretag)
1406  	n := 0
1407  	for i := 0; i < llen; i++ {
1408  		v := list.Get(i)
1409  		n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
1410  	}
1411  	b = protowire.AppendVarint(b, uint64(n))
1412  	for i := 0; i < llen; i++ {
1413  		v := list.Get(i)
1414  		b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
1415  	}
1416  	return b, nil
1417  }
1418  
1419  var coderSint32PackedSliceValue = valueCoderFuncs{
1420  	size:      sizeSint32PackedSliceValue,
1421  	marshal:   appendSint32PackedSliceValue,
1422  	unmarshal: consumeSint32SliceValue,
1423  	merge:     mergeListValue,
1424  }
1425  
1426  // sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.
1427  func sizeUint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1428  	v := *p.Uint32()
1429  	return f.tagsize + protowire.SizeVarint(uint64(v))
1430  }
1431  
1432  // appendUint32 wire encodes a uint32 pointer as a Uint32.
1433  func appendUint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1434  	v := *p.Uint32()
1435  	b = protowire.AppendVarint(b, f.wiretag)
1436  	b = protowire.AppendVarint(b, uint64(v))
1437  	return b, nil
1438  }
1439  
1440  // consumeUint32 wire decodes a uint32 pointer as a Uint32.
1441  func consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1442  	if wtyp != protowire.VarintType {
1443  		return out, errUnknown
1444  	}
1445  	var v uint64
1446  	var n int
1447  	if len(b) >= 1 && b[0] < 0x80 {
1448  		v = uint64(b[0])
1449  		n = 1
1450  	} else if len(b) >= 2 && b[1] < 128 {
1451  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1452  		n = 2
1453  	} else {
1454  		v, n = protowire.ConsumeVarint(b)
1455  	}
1456  	if n < 0 {
1457  		return out, errDecode
1458  	}
1459  	*p.Uint32() = uint32(v)
1460  	out.n = n
1461  	return out, nil
1462  }
1463  
1464  var coderUint32 = pointerCoderFuncs{
1465  	size:      sizeUint32,
1466  	marshal:   appendUint32,
1467  	unmarshal: consumeUint32,
1468  	merge:     mergeUint32,
1469  }
1470  
1471  // sizeUint32NoZero returns the size of wire encoding a uint32 pointer as a Uint32.
1472  // The zero value is not encoded.
1473  func sizeUint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1474  	v := *p.Uint32()
1475  	if v == 0 {
1476  		return 0
1477  	}
1478  	return f.tagsize + protowire.SizeVarint(uint64(v))
1479  }
1480  
1481  // appendUint32NoZero wire encodes a uint32 pointer as a Uint32.
1482  // The zero value is not encoded.
1483  func appendUint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1484  	v := *p.Uint32()
1485  	if v == 0 {
1486  		return b, nil
1487  	}
1488  	b = protowire.AppendVarint(b, f.wiretag)
1489  	b = protowire.AppendVarint(b, uint64(v))
1490  	return b, nil
1491  }
1492  
1493  var coderUint32NoZero = pointerCoderFuncs{
1494  	size:      sizeUint32NoZero,
1495  	marshal:   appendUint32NoZero,
1496  	unmarshal: consumeUint32,
1497  	merge:     mergeUint32NoZero,
1498  }
1499  
1500  // sizeUint32Ptr returns the size of wire encoding a *uint32 pointer as a Uint32.
1501  // It panics if the pointer is nil.
1502  func sizeUint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1503  	v := **p.Uint32Ptr()
1504  	return f.tagsize + protowire.SizeVarint(uint64(v))
1505  }
1506  
1507  // appendUint32Ptr wire encodes a *uint32 pointer as a Uint32.
1508  // It panics if the pointer is nil.
1509  func appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1510  	v := **p.Uint32Ptr()
1511  	b = protowire.AppendVarint(b, f.wiretag)
1512  	b = protowire.AppendVarint(b, uint64(v))
1513  	return b, nil
1514  }
1515  
1516  // consumeUint32Ptr wire decodes a *uint32 pointer as a Uint32.
1517  func consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1518  	if wtyp != protowire.VarintType {
1519  		return out, errUnknown
1520  	}
1521  	var v uint64
1522  	var n int
1523  	if len(b) >= 1 && b[0] < 0x80 {
1524  		v = uint64(b[0])
1525  		n = 1
1526  	} else if len(b) >= 2 && b[1] < 128 {
1527  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1528  		n = 2
1529  	} else {
1530  		v, n = protowire.ConsumeVarint(b)
1531  	}
1532  	if n < 0 {
1533  		return out, errDecode
1534  	}
1535  	vp := p.Uint32Ptr()
1536  	if *vp == nil {
1537  		*vp = new(uint32)
1538  	}
1539  	**vp = uint32(v)
1540  	out.n = n
1541  	return out, nil
1542  }
1543  
1544  var coderUint32Ptr = pointerCoderFuncs{
1545  	size:      sizeUint32Ptr,
1546  	marshal:   appendUint32Ptr,
1547  	unmarshal: consumeUint32Ptr,
1548  	merge:     mergeUint32Ptr,
1549  }
1550  
1551  // sizeUint32Slice returns the size of wire encoding a []uint32 pointer as a repeated Uint32.
1552  func sizeUint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1553  	s := *p.Uint32Slice()
1554  	for _, v := range s {
1555  		size += f.tagsize + protowire.SizeVarint(uint64(v))
1556  	}
1557  	return size
1558  }
1559  
1560  // appendUint32Slice encodes a []uint32 pointer as a repeated Uint32.
1561  func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1562  	s := *p.Uint32Slice()
1563  	for _, v := range s {
1564  		b = protowire.AppendVarint(b, f.wiretag)
1565  		b = protowire.AppendVarint(b, uint64(v))
1566  	}
1567  	return b, nil
1568  }
1569  
1570  // consumeUint32Slice wire decodes a []uint32 pointer as a repeated Uint32.
1571  func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1572  	sp := p.Uint32Slice()
1573  	if wtyp == protowire.BytesType {
1574  		b, n := protowire.ConsumeBytes(b)
1575  		if n < 0 {
1576  			return out, errDecode
1577  		}
1578  		count := 0
1579  		for _, v := range b {
1580  			if v < 0x80 {
1581  				count++
1582  			}
1583  		}
1584  		if count > 0 {
1585  			p.growUint32Slice(count)
1586  		}
1587  		s := *sp
1588  		for len(b) > 0 {
1589  			var v uint64
1590  			var n int
1591  			if len(b) >= 1 && b[0] < 0x80 {
1592  				v = uint64(b[0])
1593  				n = 1
1594  			} else if len(b) >= 2 && b[1] < 128 {
1595  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1596  				n = 2
1597  			} else {
1598  				v, n = protowire.ConsumeVarint(b)
1599  			}
1600  			if n < 0 {
1601  				return out, errDecode
1602  			}
1603  			s = append(s, uint32(v))
1604  			b = b[n:]
1605  		}
1606  		*sp = s
1607  		out.n = n
1608  		return out, nil
1609  	}
1610  	if wtyp != protowire.VarintType {
1611  		return out, errUnknown
1612  	}
1613  	var v uint64
1614  	var n int
1615  	if len(b) >= 1 && b[0] < 0x80 {
1616  		v = uint64(b[0])
1617  		n = 1
1618  	} else if len(b) >= 2 && b[1] < 128 {
1619  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1620  		n = 2
1621  	} else {
1622  		v, n = protowire.ConsumeVarint(b)
1623  	}
1624  	if n < 0 {
1625  		return out, errDecode
1626  	}
1627  	*sp = append(*sp, uint32(v))
1628  	out.n = n
1629  	return out, nil
1630  }
1631  
1632  var coderUint32Slice = pointerCoderFuncs{
1633  	size:      sizeUint32Slice,
1634  	marshal:   appendUint32Slice,
1635  	unmarshal: consumeUint32Slice,
1636  	merge:     mergeUint32Slice,
1637  }
1638  
1639  // sizeUint32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Uint32.
1640  func sizeUint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1641  	s := *p.Uint32Slice()
1642  	if len(s) == 0 {
1643  		return 0
1644  	}
1645  	n := 0
1646  	for _, v := range s {
1647  		n += protowire.SizeVarint(uint64(v))
1648  	}
1649  	return f.tagsize + protowire.SizeBytes(n)
1650  }
1651  
1652  // appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32.
1653  func appendUint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1654  	s := *p.Uint32Slice()
1655  	if len(s) == 0 {
1656  		return b, nil
1657  	}
1658  	b = protowire.AppendVarint(b, f.wiretag)
1659  	n := 0
1660  	for _, v := range s {
1661  		n += protowire.SizeVarint(uint64(v))
1662  	}
1663  	b = protowire.AppendVarint(b, uint64(n))
1664  	for _, v := range s {
1665  		b = protowire.AppendVarint(b, uint64(v))
1666  	}
1667  	return b, nil
1668  }
1669  
1670  var coderUint32PackedSlice = pointerCoderFuncs{
1671  	size:      sizeUint32PackedSlice,
1672  	marshal:   appendUint32PackedSlice,
1673  	unmarshal: consumeUint32Slice,
1674  	merge:     mergeUint32Slice,
1675  }
1676  
1677  // sizeUint32Value returns the size of wire encoding a uint32 value as a Uint32.
1678  func sizeUint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
1679  	return tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))
1680  }
1681  
1682  // appendUint32Value encodes a uint32 value as a Uint32.
1683  func appendUint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
1684  	b = protowire.AppendVarint(b, wiretag)
1685  	b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
1686  	return b, nil
1687  }
1688  
1689  // consumeUint32Value decodes a uint32 value as a Uint32.
1690  func consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
1691  	if wtyp != protowire.VarintType {
1692  		return protoreflect.Value{}, out, errUnknown
1693  	}
1694  	var v uint64
1695  	var n int
1696  	if len(b) >= 1 && b[0] < 0x80 {
1697  		v = uint64(b[0])
1698  		n = 1
1699  	} else if len(b) >= 2 && b[1] < 128 {
1700  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1701  		n = 2
1702  	} else {
1703  		v, n = protowire.ConsumeVarint(b)
1704  	}
1705  	if n < 0 {
1706  		return protoreflect.Value{}, out, errDecode
1707  	}
1708  	out.n = n
1709  	return protoreflect.ValueOfUint32(uint32(v)), out, nil
1710  }
1711  
1712  var coderUint32Value = valueCoderFuncs{
1713  	size:      sizeUint32Value,
1714  	marshal:   appendUint32Value,
1715  	unmarshal: consumeUint32Value,
1716  	merge:     mergeScalarValue,
1717  }
1718  
1719  // sizeUint32SliceValue returns the size of wire encoding a []uint32 value as a repeated Uint32.
1720  func sizeUint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
1721  	list := listv.List()
1722  	for i, llen := 0, list.Len(); i < llen; i++ {
1723  		v := list.Get(i)
1724  		size += tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))
1725  	}
1726  	return size
1727  }
1728  
1729  // appendUint32SliceValue encodes a []uint32 value as a repeated Uint32.
1730  func appendUint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
1731  	list := listv.List()
1732  	for i, llen := 0, list.Len(); i < llen; i++ {
1733  		v := list.Get(i)
1734  		b = protowire.AppendVarint(b, wiretag)
1735  		b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
1736  	}
1737  	return b, nil
1738  }
1739  
1740  // consumeUint32SliceValue wire decodes a []uint32 value as a repeated Uint32.
1741  func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
1742  	list := listv.List()
1743  	if wtyp == protowire.BytesType {
1744  		b, n := protowire.ConsumeBytes(b)
1745  		if n < 0 {
1746  			return protoreflect.Value{}, out, errDecode
1747  		}
1748  		for len(b) > 0 {
1749  			var v uint64
1750  			var n int
1751  			if len(b) >= 1 && b[0] < 0x80 {
1752  				v = uint64(b[0])
1753  				n = 1
1754  			} else if len(b) >= 2 && b[1] < 128 {
1755  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1756  				n = 2
1757  			} else {
1758  				v, n = protowire.ConsumeVarint(b)
1759  			}
1760  			if n < 0 {
1761  				return protoreflect.Value{}, out, errDecode
1762  			}
1763  			list.Append(protoreflect.ValueOfUint32(uint32(v)))
1764  			b = b[n:]
1765  		}
1766  		out.n = n
1767  		return listv, out, nil
1768  	}
1769  	if wtyp != protowire.VarintType {
1770  		return protoreflect.Value{}, out, errUnknown
1771  	}
1772  	var v uint64
1773  	var n int
1774  	if len(b) >= 1 && b[0] < 0x80 {
1775  		v = uint64(b[0])
1776  		n = 1
1777  	} else if len(b) >= 2 && b[1] < 128 {
1778  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1779  		n = 2
1780  	} else {
1781  		v, n = protowire.ConsumeVarint(b)
1782  	}
1783  	if n < 0 {
1784  		return protoreflect.Value{}, out, errDecode
1785  	}
1786  	list.Append(protoreflect.ValueOfUint32(uint32(v)))
1787  	out.n = n
1788  	return listv, out, nil
1789  }
1790  
1791  var coderUint32SliceValue = valueCoderFuncs{
1792  	size:      sizeUint32SliceValue,
1793  	marshal:   appendUint32SliceValue,
1794  	unmarshal: consumeUint32SliceValue,
1795  	merge:     mergeListValue,
1796  }
1797  
1798  // sizeUint32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Uint32.
1799  func sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
1800  	list := listv.List()
1801  	llen := list.Len()
1802  	if llen == 0 {
1803  		return 0
1804  	}
1805  	n := 0
1806  	for i, llen := 0, llen; i < llen; i++ {
1807  		v := list.Get(i)
1808  		n += protowire.SizeVarint(uint64(uint32(v.Uint())))
1809  	}
1810  	return tagsize + protowire.SizeBytes(n)
1811  }
1812  
1813  // appendUint32PackedSliceValue encodes a []uint32 value as a packed repeated Uint32.
1814  func appendUint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
1815  	list := listv.List()
1816  	llen := list.Len()
1817  	if llen == 0 {
1818  		return b, nil
1819  	}
1820  	b = protowire.AppendVarint(b, wiretag)
1821  	n := 0
1822  	for i := 0; i < llen; i++ {
1823  		v := list.Get(i)
1824  		n += protowire.SizeVarint(uint64(uint32(v.Uint())))
1825  	}
1826  	b = protowire.AppendVarint(b, uint64(n))
1827  	for i := 0; i < llen; i++ {
1828  		v := list.Get(i)
1829  		b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
1830  	}
1831  	return b, nil
1832  }
1833  
1834  var coderUint32PackedSliceValue = valueCoderFuncs{
1835  	size:      sizeUint32PackedSliceValue,
1836  	marshal:   appendUint32PackedSliceValue,
1837  	unmarshal: consumeUint32SliceValue,
1838  	merge:     mergeListValue,
1839  }
1840  
1841  // sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.
1842  func sizeInt64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1843  	v := *p.Int64()
1844  	return f.tagsize + protowire.SizeVarint(uint64(v))
1845  }
1846  
1847  // appendInt64 wire encodes a int64 pointer as a Int64.
1848  func appendInt64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1849  	v := *p.Int64()
1850  	b = protowire.AppendVarint(b, f.wiretag)
1851  	b = protowire.AppendVarint(b, uint64(v))
1852  	return b, nil
1853  }
1854  
1855  // consumeInt64 wire decodes a int64 pointer as a Int64.
1856  func consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1857  	if wtyp != protowire.VarintType {
1858  		return out, errUnknown
1859  	}
1860  	var v uint64
1861  	var n int
1862  	if len(b) >= 1 && b[0] < 0x80 {
1863  		v = uint64(b[0])
1864  		n = 1
1865  	} else if len(b) >= 2 && b[1] < 128 {
1866  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1867  		n = 2
1868  	} else {
1869  		v, n = protowire.ConsumeVarint(b)
1870  	}
1871  	if n < 0 {
1872  		return out, errDecode
1873  	}
1874  	*p.Int64() = int64(v)
1875  	out.n = n
1876  	return out, nil
1877  }
1878  
1879  var coderInt64 = pointerCoderFuncs{
1880  	size:      sizeInt64,
1881  	marshal:   appendInt64,
1882  	unmarshal: consumeInt64,
1883  	merge:     mergeInt64,
1884  }
1885  
1886  // sizeInt64NoZero returns the size of wire encoding a int64 pointer as a Int64.
1887  // The zero value is not encoded.
1888  func sizeInt64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1889  	v := *p.Int64()
1890  	if v == 0 {
1891  		return 0
1892  	}
1893  	return f.tagsize + protowire.SizeVarint(uint64(v))
1894  }
1895  
1896  // appendInt64NoZero wire encodes a int64 pointer as a Int64.
1897  // The zero value is not encoded.
1898  func appendInt64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1899  	v := *p.Int64()
1900  	if v == 0 {
1901  		return b, nil
1902  	}
1903  	b = protowire.AppendVarint(b, f.wiretag)
1904  	b = protowire.AppendVarint(b, uint64(v))
1905  	return b, nil
1906  }
1907  
1908  var coderInt64NoZero = pointerCoderFuncs{
1909  	size:      sizeInt64NoZero,
1910  	marshal:   appendInt64NoZero,
1911  	unmarshal: consumeInt64,
1912  	merge:     mergeInt64NoZero,
1913  }
1914  
1915  // sizeInt64Ptr returns the size of wire encoding a *int64 pointer as a Int64.
1916  // It panics if the pointer is nil.
1917  func sizeInt64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1918  	v := **p.Int64Ptr()
1919  	return f.tagsize + protowire.SizeVarint(uint64(v))
1920  }
1921  
1922  // appendInt64Ptr wire encodes a *int64 pointer as a Int64.
1923  // It panics if the pointer is nil.
1924  func appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1925  	v := **p.Int64Ptr()
1926  	b = protowire.AppendVarint(b, f.wiretag)
1927  	b = protowire.AppendVarint(b, uint64(v))
1928  	return b, nil
1929  }
1930  
1931  // consumeInt64Ptr wire decodes a *int64 pointer as a Int64.
1932  func consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1933  	if wtyp != protowire.VarintType {
1934  		return out, errUnknown
1935  	}
1936  	var v uint64
1937  	var n int
1938  	if len(b) >= 1 && b[0] < 0x80 {
1939  		v = uint64(b[0])
1940  		n = 1
1941  	} else if len(b) >= 2 && b[1] < 128 {
1942  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1943  		n = 2
1944  	} else {
1945  		v, n = protowire.ConsumeVarint(b)
1946  	}
1947  	if n < 0 {
1948  		return out, errDecode
1949  	}
1950  	vp := p.Int64Ptr()
1951  	if *vp == nil {
1952  		*vp = new(int64)
1953  	}
1954  	**vp = int64(v)
1955  	out.n = n
1956  	return out, nil
1957  }
1958  
1959  var coderInt64Ptr = pointerCoderFuncs{
1960  	size:      sizeInt64Ptr,
1961  	marshal:   appendInt64Ptr,
1962  	unmarshal: consumeInt64Ptr,
1963  	merge:     mergeInt64Ptr,
1964  }
1965  
1966  // sizeInt64Slice returns the size of wire encoding a []int64 pointer as a repeated Int64.
1967  func sizeInt64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1968  	s := *p.Int64Slice()
1969  	for _, v := range s {
1970  		size += f.tagsize + protowire.SizeVarint(uint64(v))
1971  	}
1972  	return size
1973  }
1974  
1975  // appendInt64Slice encodes a []int64 pointer as a repeated Int64.
1976  func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1977  	s := *p.Int64Slice()
1978  	for _, v := range s {
1979  		b = protowire.AppendVarint(b, f.wiretag)
1980  		b = protowire.AppendVarint(b, uint64(v))
1981  	}
1982  	return b, nil
1983  }
1984  
1985  // consumeInt64Slice wire decodes a []int64 pointer as a repeated Int64.
1986  func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
1987  	sp := p.Int64Slice()
1988  	if wtyp == protowire.BytesType {
1989  		b, n := protowire.ConsumeBytes(b)
1990  		if n < 0 {
1991  			return out, errDecode
1992  		}
1993  		count := 0
1994  		for _, v := range b {
1995  			if v < 0x80 {
1996  				count++
1997  			}
1998  		}
1999  		if count > 0 {
2000  			p.growInt64Slice(count)
2001  		}
2002  		s := *sp
2003  		for len(b) > 0 {
2004  			var v uint64
2005  			var n int
2006  			if len(b) >= 1 && b[0] < 0x80 {
2007  				v = uint64(b[0])
2008  				n = 1
2009  			} else if len(b) >= 2 && b[1] < 128 {
2010  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2011  				n = 2
2012  			} else {
2013  				v, n = protowire.ConsumeVarint(b)
2014  			}
2015  			if n < 0 {
2016  				return out, errDecode
2017  			}
2018  			s = append(s, int64(v))
2019  			b = b[n:]
2020  		}
2021  		*sp = s
2022  		out.n = n
2023  		return out, nil
2024  	}
2025  	if wtyp != protowire.VarintType {
2026  		return out, errUnknown
2027  	}
2028  	var v uint64
2029  	var n int
2030  	if len(b) >= 1 && b[0] < 0x80 {
2031  		v = uint64(b[0])
2032  		n = 1
2033  	} else if len(b) >= 2 && b[1] < 128 {
2034  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2035  		n = 2
2036  	} else {
2037  		v, n = protowire.ConsumeVarint(b)
2038  	}
2039  	if n < 0 {
2040  		return out, errDecode
2041  	}
2042  	*sp = append(*sp, int64(v))
2043  	out.n = n
2044  	return out, nil
2045  }
2046  
2047  var coderInt64Slice = pointerCoderFuncs{
2048  	size:      sizeInt64Slice,
2049  	marshal:   appendInt64Slice,
2050  	unmarshal: consumeInt64Slice,
2051  	merge:     mergeInt64Slice,
2052  }
2053  
2054  // sizeInt64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Int64.
2055  func sizeInt64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2056  	s := *p.Int64Slice()
2057  	if len(s) == 0 {
2058  		return 0
2059  	}
2060  	n := 0
2061  	for _, v := range s {
2062  		n += protowire.SizeVarint(uint64(v))
2063  	}
2064  	return f.tagsize + protowire.SizeBytes(n)
2065  }
2066  
2067  // appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64.
2068  func appendInt64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2069  	s := *p.Int64Slice()
2070  	if len(s) == 0 {
2071  		return b, nil
2072  	}
2073  	b = protowire.AppendVarint(b, f.wiretag)
2074  	n := 0
2075  	for _, v := range s {
2076  		n += protowire.SizeVarint(uint64(v))
2077  	}
2078  	b = protowire.AppendVarint(b, uint64(n))
2079  	for _, v := range s {
2080  		b = protowire.AppendVarint(b, uint64(v))
2081  	}
2082  	return b, nil
2083  }
2084  
2085  var coderInt64PackedSlice = pointerCoderFuncs{
2086  	size:      sizeInt64PackedSlice,
2087  	marshal:   appendInt64PackedSlice,
2088  	unmarshal: consumeInt64Slice,
2089  	merge:     mergeInt64Slice,
2090  }
2091  
2092  // sizeInt64Value returns the size of wire encoding a int64 value as a Int64.
2093  func sizeInt64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
2094  	return tagsize + protowire.SizeVarint(uint64(v.Int()))
2095  }
2096  
2097  // appendInt64Value encodes a int64 value as a Int64.
2098  func appendInt64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2099  	b = protowire.AppendVarint(b, wiretag)
2100  	b = protowire.AppendVarint(b, uint64(v.Int()))
2101  	return b, nil
2102  }
2103  
2104  // consumeInt64Value decodes a int64 value as a Int64.
2105  func consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
2106  	if wtyp != protowire.VarintType {
2107  		return protoreflect.Value{}, out, errUnknown
2108  	}
2109  	var v uint64
2110  	var n int
2111  	if len(b) >= 1 && b[0] < 0x80 {
2112  		v = uint64(b[0])
2113  		n = 1
2114  	} else if len(b) >= 2 && b[1] < 128 {
2115  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2116  		n = 2
2117  	} else {
2118  		v, n = protowire.ConsumeVarint(b)
2119  	}
2120  	if n < 0 {
2121  		return protoreflect.Value{}, out, errDecode
2122  	}
2123  	out.n = n
2124  	return protoreflect.ValueOfInt64(int64(v)), out, nil
2125  }
2126  
2127  var coderInt64Value = valueCoderFuncs{
2128  	size:      sizeInt64Value,
2129  	marshal:   appendInt64Value,
2130  	unmarshal: consumeInt64Value,
2131  	merge:     mergeScalarValue,
2132  }
2133  
2134  // sizeInt64SliceValue returns the size of wire encoding a []int64 value as a repeated Int64.
2135  func sizeInt64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
2136  	list := listv.List()
2137  	for i, llen := 0, list.Len(); i < llen; i++ {
2138  		v := list.Get(i)
2139  		size += tagsize + protowire.SizeVarint(uint64(v.Int()))
2140  	}
2141  	return size
2142  }
2143  
2144  // appendInt64SliceValue encodes a []int64 value as a repeated Int64.
2145  func appendInt64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2146  	list := listv.List()
2147  	for i, llen := 0, list.Len(); i < llen; i++ {
2148  		v := list.Get(i)
2149  		b = protowire.AppendVarint(b, wiretag)
2150  		b = protowire.AppendVarint(b, uint64(v.Int()))
2151  	}
2152  	return b, nil
2153  }
2154  
2155  // consumeInt64SliceValue wire decodes a []int64 value as a repeated Int64.
2156  func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
2157  	list := listv.List()
2158  	if wtyp == protowire.BytesType {
2159  		b, n := protowire.ConsumeBytes(b)
2160  		if n < 0 {
2161  			return protoreflect.Value{}, out, errDecode
2162  		}
2163  		for len(b) > 0 {
2164  			var v uint64
2165  			var n int
2166  			if len(b) >= 1 && b[0] < 0x80 {
2167  				v = uint64(b[0])
2168  				n = 1
2169  			} else if len(b) >= 2 && b[1] < 128 {
2170  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2171  				n = 2
2172  			} else {
2173  				v, n = protowire.ConsumeVarint(b)
2174  			}
2175  			if n < 0 {
2176  				return protoreflect.Value{}, out, errDecode
2177  			}
2178  			list.Append(protoreflect.ValueOfInt64(int64(v)))
2179  			b = b[n:]
2180  		}
2181  		out.n = n
2182  		return listv, out, nil
2183  	}
2184  	if wtyp != protowire.VarintType {
2185  		return protoreflect.Value{}, out, errUnknown
2186  	}
2187  	var v uint64
2188  	var n int
2189  	if len(b) >= 1 && b[0] < 0x80 {
2190  		v = uint64(b[0])
2191  		n = 1
2192  	} else if len(b) >= 2 && b[1] < 128 {
2193  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2194  		n = 2
2195  	} else {
2196  		v, n = protowire.ConsumeVarint(b)
2197  	}
2198  	if n < 0 {
2199  		return protoreflect.Value{}, out, errDecode
2200  	}
2201  	list.Append(protoreflect.ValueOfInt64(int64(v)))
2202  	out.n = n
2203  	return listv, out, nil
2204  }
2205  
2206  var coderInt64SliceValue = valueCoderFuncs{
2207  	size:      sizeInt64SliceValue,
2208  	marshal:   appendInt64SliceValue,
2209  	unmarshal: consumeInt64SliceValue,
2210  	merge:     mergeListValue,
2211  }
2212  
2213  // sizeInt64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Int64.
2214  func sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
2215  	list := listv.List()
2216  	llen := list.Len()
2217  	if llen == 0 {
2218  		return 0
2219  	}
2220  	n := 0
2221  	for i, llen := 0, llen; i < llen; i++ {
2222  		v := list.Get(i)
2223  		n += protowire.SizeVarint(uint64(v.Int()))
2224  	}
2225  	return tagsize + protowire.SizeBytes(n)
2226  }
2227  
2228  // appendInt64PackedSliceValue encodes a []int64 value as a packed repeated Int64.
2229  func appendInt64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2230  	list := listv.List()
2231  	llen := list.Len()
2232  	if llen == 0 {
2233  		return b, nil
2234  	}
2235  	b = protowire.AppendVarint(b, wiretag)
2236  	n := 0
2237  	for i := 0; i < llen; i++ {
2238  		v := list.Get(i)
2239  		n += protowire.SizeVarint(uint64(v.Int()))
2240  	}
2241  	b = protowire.AppendVarint(b, uint64(n))
2242  	for i := 0; i < llen; i++ {
2243  		v := list.Get(i)
2244  		b = protowire.AppendVarint(b, uint64(v.Int()))
2245  	}
2246  	return b, nil
2247  }
2248  
2249  var coderInt64PackedSliceValue = valueCoderFuncs{
2250  	size:      sizeInt64PackedSliceValue,
2251  	marshal:   appendInt64PackedSliceValue,
2252  	unmarshal: consumeInt64SliceValue,
2253  	merge:     mergeListValue,
2254  }
2255  
2256  // sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.
2257  func sizeSint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2258  	v := *p.Int64()
2259  	return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
2260  }
2261  
2262  // appendSint64 wire encodes a int64 pointer as a Sint64.
2263  func appendSint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2264  	v := *p.Int64()
2265  	b = protowire.AppendVarint(b, f.wiretag)
2266  	b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
2267  	return b, nil
2268  }
2269  
2270  // consumeSint64 wire decodes a int64 pointer as a Sint64.
2271  func consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
2272  	if wtyp != protowire.VarintType {
2273  		return out, errUnknown
2274  	}
2275  	var v uint64
2276  	var n int
2277  	if len(b) >= 1 && b[0] < 0x80 {
2278  		v = uint64(b[0])
2279  		n = 1
2280  	} else if len(b) >= 2 && b[1] < 128 {
2281  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2282  		n = 2
2283  	} else {
2284  		v, n = protowire.ConsumeVarint(b)
2285  	}
2286  	if n < 0 {
2287  		return out, errDecode
2288  	}
2289  	*p.Int64() = protowire.DecodeZigZag(v)
2290  	out.n = n
2291  	return out, nil
2292  }
2293  
2294  var coderSint64 = pointerCoderFuncs{
2295  	size:      sizeSint64,
2296  	marshal:   appendSint64,
2297  	unmarshal: consumeSint64,
2298  	merge:     mergeInt64,
2299  }
2300  
2301  // sizeSint64NoZero returns the size of wire encoding a int64 pointer as a Sint64.
2302  // The zero value is not encoded.
2303  func sizeSint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2304  	v := *p.Int64()
2305  	if v == 0 {
2306  		return 0
2307  	}
2308  	return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
2309  }
2310  
2311  // appendSint64NoZero wire encodes a int64 pointer as a Sint64.
2312  // The zero value is not encoded.
2313  func appendSint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2314  	v := *p.Int64()
2315  	if v == 0 {
2316  		return b, nil
2317  	}
2318  	b = protowire.AppendVarint(b, f.wiretag)
2319  	b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
2320  	return b, nil
2321  }
2322  
2323  var coderSint64NoZero = pointerCoderFuncs{
2324  	size:      sizeSint64NoZero,
2325  	marshal:   appendSint64NoZero,
2326  	unmarshal: consumeSint64,
2327  	merge:     mergeInt64NoZero,
2328  }
2329  
2330  // sizeSint64Ptr returns the size of wire encoding a *int64 pointer as a Sint64.
2331  // It panics if the pointer is nil.
2332  func sizeSint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2333  	v := **p.Int64Ptr()
2334  	return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
2335  }
2336  
2337  // appendSint64Ptr wire encodes a *int64 pointer as a Sint64.
2338  // It panics if the pointer is nil.
2339  func appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2340  	v := **p.Int64Ptr()
2341  	b = protowire.AppendVarint(b, f.wiretag)
2342  	b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
2343  	return b, nil
2344  }
2345  
2346  // consumeSint64Ptr wire decodes a *int64 pointer as a Sint64.
2347  func consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
2348  	if wtyp != protowire.VarintType {
2349  		return out, errUnknown
2350  	}
2351  	var v uint64
2352  	var n int
2353  	if len(b) >= 1 && b[0] < 0x80 {
2354  		v = uint64(b[0])
2355  		n = 1
2356  	} else if len(b) >= 2 && b[1] < 128 {
2357  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2358  		n = 2
2359  	} else {
2360  		v, n = protowire.ConsumeVarint(b)
2361  	}
2362  	if n < 0 {
2363  		return out, errDecode
2364  	}
2365  	vp := p.Int64Ptr()
2366  	if *vp == nil {
2367  		*vp = new(int64)
2368  	}
2369  	**vp = protowire.DecodeZigZag(v)
2370  	out.n = n
2371  	return out, nil
2372  }
2373  
2374  var coderSint64Ptr = pointerCoderFuncs{
2375  	size:      sizeSint64Ptr,
2376  	marshal:   appendSint64Ptr,
2377  	unmarshal: consumeSint64Ptr,
2378  	merge:     mergeInt64Ptr,
2379  }
2380  
2381  // sizeSint64Slice returns the size of wire encoding a []int64 pointer as a repeated Sint64.
2382  func sizeSint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2383  	s := *p.Int64Slice()
2384  	for _, v := range s {
2385  		size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
2386  	}
2387  	return size
2388  }
2389  
2390  // appendSint64Slice encodes a []int64 pointer as a repeated Sint64.
2391  func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2392  	s := *p.Int64Slice()
2393  	for _, v := range s {
2394  		b = protowire.AppendVarint(b, f.wiretag)
2395  		b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
2396  	}
2397  	return b, nil
2398  }
2399  
2400  // consumeSint64Slice wire decodes a []int64 pointer as a repeated Sint64.
2401  func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
2402  	sp := p.Int64Slice()
2403  	if wtyp == protowire.BytesType {
2404  		b, n := protowire.ConsumeBytes(b)
2405  		if n < 0 {
2406  			return out, errDecode
2407  		}
2408  		count := 0
2409  		for _, v := range b {
2410  			if v < 0x80 {
2411  				count++
2412  			}
2413  		}
2414  		if count > 0 {
2415  			p.growInt64Slice(count)
2416  		}
2417  		s := *sp
2418  		for len(b) > 0 {
2419  			var v uint64
2420  			var n int
2421  			if len(b) >= 1 && b[0] < 0x80 {
2422  				v = uint64(b[0])
2423  				n = 1
2424  			} else if len(b) >= 2 && b[1] < 128 {
2425  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2426  				n = 2
2427  			} else {
2428  				v, n = protowire.ConsumeVarint(b)
2429  			}
2430  			if n < 0 {
2431  				return out, errDecode
2432  			}
2433  			s = append(s, protowire.DecodeZigZag(v))
2434  			b = b[n:]
2435  		}
2436  		*sp = s
2437  		out.n = n
2438  		return out, nil
2439  	}
2440  	if wtyp != protowire.VarintType {
2441  		return out, errUnknown
2442  	}
2443  	var v uint64
2444  	var n int
2445  	if len(b) >= 1 && b[0] < 0x80 {
2446  		v = uint64(b[0])
2447  		n = 1
2448  	} else if len(b) >= 2 && b[1] < 128 {
2449  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2450  		n = 2
2451  	} else {
2452  		v, n = protowire.ConsumeVarint(b)
2453  	}
2454  	if n < 0 {
2455  		return out, errDecode
2456  	}
2457  	*sp = append(*sp, protowire.DecodeZigZag(v))
2458  	out.n = n
2459  	return out, nil
2460  }
2461  
2462  var coderSint64Slice = pointerCoderFuncs{
2463  	size:      sizeSint64Slice,
2464  	marshal:   appendSint64Slice,
2465  	unmarshal: consumeSint64Slice,
2466  	merge:     mergeInt64Slice,
2467  }
2468  
2469  // sizeSint64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sint64.
2470  func sizeSint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2471  	s := *p.Int64Slice()
2472  	if len(s) == 0 {
2473  		return 0
2474  	}
2475  	n := 0
2476  	for _, v := range s {
2477  		n += protowire.SizeVarint(protowire.EncodeZigZag(v))
2478  	}
2479  	return f.tagsize + protowire.SizeBytes(n)
2480  }
2481  
2482  // appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64.
2483  func appendSint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2484  	s := *p.Int64Slice()
2485  	if len(s) == 0 {
2486  		return b, nil
2487  	}
2488  	b = protowire.AppendVarint(b, f.wiretag)
2489  	n := 0
2490  	for _, v := range s {
2491  		n += protowire.SizeVarint(protowire.EncodeZigZag(v))
2492  	}
2493  	b = protowire.AppendVarint(b, uint64(n))
2494  	for _, v := range s {
2495  		b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
2496  	}
2497  	return b, nil
2498  }
2499  
2500  var coderSint64PackedSlice = pointerCoderFuncs{
2501  	size:      sizeSint64PackedSlice,
2502  	marshal:   appendSint64PackedSlice,
2503  	unmarshal: consumeSint64Slice,
2504  	merge:     mergeInt64Slice,
2505  }
2506  
2507  // sizeSint64Value returns the size of wire encoding a int64 value as a Sint64.
2508  func sizeSint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
2509  	return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
2510  }
2511  
2512  // appendSint64Value encodes a int64 value as a Sint64.
2513  func appendSint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2514  	b = protowire.AppendVarint(b, wiretag)
2515  	b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
2516  	return b, nil
2517  }
2518  
2519  // consumeSint64Value decodes a int64 value as a Sint64.
2520  func consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
2521  	if wtyp != protowire.VarintType {
2522  		return protoreflect.Value{}, out, errUnknown
2523  	}
2524  	var v uint64
2525  	var n int
2526  	if len(b) >= 1 && b[0] < 0x80 {
2527  		v = uint64(b[0])
2528  		n = 1
2529  	} else if len(b) >= 2 && b[1] < 128 {
2530  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2531  		n = 2
2532  	} else {
2533  		v, n = protowire.ConsumeVarint(b)
2534  	}
2535  	if n < 0 {
2536  		return protoreflect.Value{}, out, errDecode
2537  	}
2538  	out.n = n
2539  	return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), out, nil
2540  }
2541  
2542  var coderSint64Value = valueCoderFuncs{
2543  	size:      sizeSint64Value,
2544  	marshal:   appendSint64Value,
2545  	unmarshal: consumeSint64Value,
2546  	merge:     mergeScalarValue,
2547  }
2548  
2549  // sizeSint64SliceValue returns the size of wire encoding a []int64 value as a repeated Sint64.
2550  func sizeSint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
2551  	list := listv.List()
2552  	for i, llen := 0, list.Len(); i < llen; i++ {
2553  		v := list.Get(i)
2554  		size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
2555  	}
2556  	return size
2557  }
2558  
2559  // appendSint64SliceValue encodes a []int64 value as a repeated Sint64.
2560  func appendSint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2561  	list := listv.List()
2562  	for i, llen := 0, list.Len(); i < llen; i++ {
2563  		v := list.Get(i)
2564  		b = protowire.AppendVarint(b, wiretag)
2565  		b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
2566  	}
2567  	return b, nil
2568  }
2569  
2570  // consumeSint64SliceValue wire decodes a []int64 value as a repeated Sint64.
2571  func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
2572  	list := listv.List()
2573  	if wtyp == protowire.BytesType {
2574  		b, n := protowire.ConsumeBytes(b)
2575  		if n < 0 {
2576  			return protoreflect.Value{}, out, errDecode
2577  		}
2578  		for len(b) > 0 {
2579  			var v uint64
2580  			var n int
2581  			if len(b) >= 1 && b[0] < 0x80 {
2582  				v = uint64(b[0])
2583  				n = 1
2584  			} else if len(b) >= 2 && b[1] < 128 {
2585  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2586  				n = 2
2587  			} else {
2588  				v, n = protowire.ConsumeVarint(b)
2589  			}
2590  			if n < 0 {
2591  				return protoreflect.Value{}, out, errDecode
2592  			}
2593  			list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
2594  			b = b[n:]
2595  		}
2596  		out.n = n
2597  		return listv, out, nil
2598  	}
2599  	if wtyp != protowire.VarintType {
2600  		return protoreflect.Value{}, out, errUnknown
2601  	}
2602  	var v uint64
2603  	var n int
2604  	if len(b) >= 1 && b[0] < 0x80 {
2605  		v = uint64(b[0])
2606  		n = 1
2607  	} else if len(b) >= 2 && b[1] < 128 {
2608  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2609  		n = 2
2610  	} else {
2611  		v, n = protowire.ConsumeVarint(b)
2612  	}
2613  	if n < 0 {
2614  		return protoreflect.Value{}, out, errDecode
2615  	}
2616  	list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
2617  	out.n = n
2618  	return listv, out, nil
2619  }
2620  
2621  var coderSint64SliceValue = valueCoderFuncs{
2622  	size:      sizeSint64SliceValue,
2623  	marshal:   appendSint64SliceValue,
2624  	unmarshal: consumeSint64SliceValue,
2625  	merge:     mergeListValue,
2626  }
2627  
2628  // sizeSint64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sint64.
2629  func sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
2630  	list := listv.List()
2631  	llen := list.Len()
2632  	if llen == 0 {
2633  		return 0
2634  	}
2635  	n := 0
2636  	for i, llen := 0, llen; i < llen; i++ {
2637  		v := list.Get(i)
2638  		n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
2639  	}
2640  	return tagsize + protowire.SizeBytes(n)
2641  }
2642  
2643  // appendSint64PackedSliceValue encodes a []int64 value as a packed repeated Sint64.
2644  func appendSint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2645  	list := listv.List()
2646  	llen := list.Len()
2647  	if llen == 0 {
2648  		return b, nil
2649  	}
2650  	b = protowire.AppendVarint(b, wiretag)
2651  	n := 0
2652  	for i := 0; i < llen; i++ {
2653  		v := list.Get(i)
2654  		n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
2655  	}
2656  	b = protowire.AppendVarint(b, uint64(n))
2657  	for i := 0; i < llen; i++ {
2658  		v := list.Get(i)
2659  		b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
2660  	}
2661  	return b, nil
2662  }
2663  
2664  var coderSint64PackedSliceValue = valueCoderFuncs{
2665  	size:      sizeSint64PackedSliceValue,
2666  	marshal:   appendSint64PackedSliceValue,
2667  	unmarshal: consumeSint64SliceValue,
2668  	merge:     mergeListValue,
2669  }
2670  
2671  // sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.
2672  func sizeUint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2673  	v := *p.Uint64()
2674  	return f.tagsize + protowire.SizeVarint(v)
2675  }
2676  
2677  // appendUint64 wire encodes a uint64 pointer as a Uint64.
2678  func appendUint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2679  	v := *p.Uint64()
2680  	b = protowire.AppendVarint(b, f.wiretag)
2681  	b = protowire.AppendVarint(b, v)
2682  	return b, nil
2683  }
2684  
2685  // consumeUint64 wire decodes a uint64 pointer as a Uint64.
2686  func consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
2687  	if wtyp != protowire.VarintType {
2688  		return out, errUnknown
2689  	}
2690  	var v uint64
2691  	var n int
2692  	if len(b) >= 1 && b[0] < 0x80 {
2693  		v = uint64(b[0])
2694  		n = 1
2695  	} else if len(b) >= 2 && b[1] < 128 {
2696  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2697  		n = 2
2698  	} else {
2699  		v, n = protowire.ConsumeVarint(b)
2700  	}
2701  	if n < 0 {
2702  		return out, errDecode
2703  	}
2704  	*p.Uint64() = v
2705  	out.n = n
2706  	return out, nil
2707  }
2708  
2709  var coderUint64 = pointerCoderFuncs{
2710  	size:      sizeUint64,
2711  	marshal:   appendUint64,
2712  	unmarshal: consumeUint64,
2713  	merge:     mergeUint64,
2714  }
2715  
2716  // sizeUint64NoZero returns the size of wire encoding a uint64 pointer as a Uint64.
2717  // The zero value is not encoded.
2718  func sizeUint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2719  	v := *p.Uint64()
2720  	if v == 0 {
2721  		return 0
2722  	}
2723  	return f.tagsize + protowire.SizeVarint(v)
2724  }
2725  
2726  // appendUint64NoZero wire encodes a uint64 pointer as a Uint64.
2727  // The zero value is not encoded.
2728  func appendUint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2729  	v := *p.Uint64()
2730  	if v == 0 {
2731  		return b, nil
2732  	}
2733  	b = protowire.AppendVarint(b, f.wiretag)
2734  	b = protowire.AppendVarint(b, v)
2735  	return b, nil
2736  }
2737  
2738  var coderUint64NoZero = pointerCoderFuncs{
2739  	size:      sizeUint64NoZero,
2740  	marshal:   appendUint64NoZero,
2741  	unmarshal: consumeUint64,
2742  	merge:     mergeUint64NoZero,
2743  }
2744  
2745  // sizeUint64Ptr returns the size of wire encoding a *uint64 pointer as a Uint64.
2746  // It panics if the pointer is nil.
2747  func sizeUint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2748  	v := **p.Uint64Ptr()
2749  	return f.tagsize + protowire.SizeVarint(v)
2750  }
2751  
2752  // appendUint64Ptr wire encodes a *uint64 pointer as a Uint64.
2753  // It panics if the pointer is nil.
2754  func appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2755  	v := **p.Uint64Ptr()
2756  	b = protowire.AppendVarint(b, f.wiretag)
2757  	b = protowire.AppendVarint(b, v)
2758  	return b, nil
2759  }
2760  
2761  // consumeUint64Ptr wire decodes a *uint64 pointer as a Uint64.
2762  func consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
2763  	if wtyp != protowire.VarintType {
2764  		return out, errUnknown
2765  	}
2766  	var v uint64
2767  	var n int
2768  	if len(b) >= 1 && b[0] < 0x80 {
2769  		v = uint64(b[0])
2770  		n = 1
2771  	} else if len(b) >= 2 && b[1] < 128 {
2772  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2773  		n = 2
2774  	} else {
2775  		v, n = protowire.ConsumeVarint(b)
2776  	}
2777  	if n < 0 {
2778  		return out, errDecode
2779  	}
2780  	vp := p.Uint64Ptr()
2781  	if *vp == nil {
2782  		*vp = new(uint64)
2783  	}
2784  	**vp = v
2785  	out.n = n
2786  	return out, nil
2787  }
2788  
2789  var coderUint64Ptr = pointerCoderFuncs{
2790  	size:      sizeUint64Ptr,
2791  	marshal:   appendUint64Ptr,
2792  	unmarshal: consumeUint64Ptr,
2793  	merge:     mergeUint64Ptr,
2794  }
2795  
2796  // sizeUint64Slice returns the size of wire encoding a []uint64 pointer as a repeated Uint64.
2797  func sizeUint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2798  	s := *p.Uint64Slice()
2799  	for _, v := range s {
2800  		size += f.tagsize + protowire.SizeVarint(v)
2801  	}
2802  	return size
2803  }
2804  
2805  // appendUint64Slice encodes a []uint64 pointer as a repeated Uint64.
2806  func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2807  	s := *p.Uint64Slice()
2808  	for _, v := range s {
2809  		b = protowire.AppendVarint(b, f.wiretag)
2810  		b = protowire.AppendVarint(b, v)
2811  	}
2812  	return b, nil
2813  }
2814  
2815  // consumeUint64Slice wire decodes a []uint64 pointer as a repeated Uint64.
2816  func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
2817  	sp := p.Uint64Slice()
2818  	if wtyp == protowire.BytesType {
2819  		b, n := protowire.ConsumeBytes(b)
2820  		if n < 0 {
2821  			return out, errDecode
2822  		}
2823  		count := 0
2824  		for _, v := range b {
2825  			if v < 0x80 {
2826  				count++
2827  			}
2828  		}
2829  		if count > 0 {
2830  			p.growUint64Slice(count)
2831  		}
2832  		s := *sp
2833  		for len(b) > 0 {
2834  			var v uint64
2835  			var n int
2836  			if len(b) >= 1 && b[0] < 0x80 {
2837  				v = uint64(b[0])
2838  				n = 1
2839  			} else if len(b) >= 2 && b[1] < 128 {
2840  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2841  				n = 2
2842  			} else {
2843  				v, n = protowire.ConsumeVarint(b)
2844  			}
2845  			if n < 0 {
2846  				return out, errDecode
2847  			}
2848  			s = append(s, v)
2849  			b = b[n:]
2850  		}
2851  		*sp = s
2852  		out.n = n
2853  		return out, nil
2854  	}
2855  	if wtyp != protowire.VarintType {
2856  		return out, errUnknown
2857  	}
2858  	var v uint64
2859  	var n int
2860  	if len(b) >= 1 && b[0] < 0x80 {
2861  		v = uint64(b[0])
2862  		n = 1
2863  	} else if len(b) >= 2 && b[1] < 128 {
2864  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2865  		n = 2
2866  	} else {
2867  		v, n = protowire.ConsumeVarint(b)
2868  	}
2869  	if n < 0 {
2870  		return out, errDecode
2871  	}
2872  	*sp = append(*sp, v)
2873  	out.n = n
2874  	return out, nil
2875  }
2876  
2877  var coderUint64Slice = pointerCoderFuncs{
2878  	size:      sizeUint64Slice,
2879  	marshal:   appendUint64Slice,
2880  	unmarshal: consumeUint64Slice,
2881  	merge:     mergeUint64Slice,
2882  }
2883  
2884  // sizeUint64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Uint64.
2885  func sizeUint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2886  	s := *p.Uint64Slice()
2887  	if len(s) == 0 {
2888  		return 0
2889  	}
2890  	n := 0
2891  	for _, v := range s {
2892  		n += protowire.SizeVarint(v)
2893  	}
2894  	return f.tagsize + protowire.SizeBytes(n)
2895  }
2896  
2897  // appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64.
2898  func appendUint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2899  	s := *p.Uint64Slice()
2900  	if len(s) == 0 {
2901  		return b, nil
2902  	}
2903  	b = protowire.AppendVarint(b, f.wiretag)
2904  	n := 0
2905  	for _, v := range s {
2906  		n += protowire.SizeVarint(v)
2907  	}
2908  	b = protowire.AppendVarint(b, uint64(n))
2909  	for _, v := range s {
2910  		b = protowire.AppendVarint(b, v)
2911  	}
2912  	return b, nil
2913  }
2914  
2915  var coderUint64PackedSlice = pointerCoderFuncs{
2916  	size:      sizeUint64PackedSlice,
2917  	marshal:   appendUint64PackedSlice,
2918  	unmarshal: consumeUint64Slice,
2919  	merge:     mergeUint64Slice,
2920  }
2921  
2922  // sizeUint64Value returns the size of wire encoding a uint64 value as a Uint64.
2923  func sizeUint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
2924  	return tagsize + protowire.SizeVarint(v.Uint())
2925  }
2926  
2927  // appendUint64Value encodes a uint64 value as a Uint64.
2928  func appendUint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2929  	b = protowire.AppendVarint(b, wiretag)
2930  	b = protowire.AppendVarint(b, v.Uint())
2931  	return b, nil
2932  }
2933  
2934  // consumeUint64Value decodes a uint64 value as a Uint64.
2935  func consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
2936  	if wtyp != protowire.VarintType {
2937  		return protoreflect.Value{}, out, errUnknown
2938  	}
2939  	var v uint64
2940  	var n int
2941  	if len(b) >= 1 && b[0] < 0x80 {
2942  		v = uint64(b[0])
2943  		n = 1
2944  	} else if len(b) >= 2 && b[1] < 128 {
2945  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2946  		n = 2
2947  	} else {
2948  		v, n = protowire.ConsumeVarint(b)
2949  	}
2950  	if n < 0 {
2951  		return protoreflect.Value{}, out, errDecode
2952  	}
2953  	out.n = n
2954  	return protoreflect.ValueOfUint64(v), out, nil
2955  }
2956  
2957  var coderUint64Value = valueCoderFuncs{
2958  	size:      sizeUint64Value,
2959  	marshal:   appendUint64Value,
2960  	unmarshal: consumeUint64Value,
2961  	merge:     mergeScalarValue,
2962  }
2963  
2964  // sizeUint64SliceValue returns the size of wire encoding a []uint64 value as a repeated Uint64.
2965  func sizeUint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
2966  	list := listv.List()
2967  	for i, llen := 0, list.Len(); i < llen; i++ {
2968  		v := list.Get(i)
2969  		size += tagsize + protowire.SizeVarint(v.Uint())
2970  	}
2971  	return size
2972  }
2973  
2974  // appendUint64SliceValue encodes a []uint64 value as a repeated Uint64.
2975  func appendUint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2976  	list := listv.List()
2977  	for i, llen := 0, list.Len(); i < llen; i++ {
2978  		v := list.Get(i)
2979  		b = protowire.AppendVarint(b, wiretag)
2980  		b = protowire.AppendVarint(b, v.Uint())
2981  	}
2982  	return b, nil
2983  }
2984  
2985  // consumeUint64SliceValue wire decodes a []uint64 value as a repeated Uint64.
2986  func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
2987  	list := listv.List()
2988  	if wtyp == protowire.BytesType {
2989  		b, n := protowire.ConsumeBytes(b)
2990  		if n < 0 {
2991  			return protoreflect.Value{}, out, errDecode
2992  		}
2993  		for len(b) > 0 {
2994  			var v uint64
2995  			var n int
2996  			if len(b) >= 1 && b[0] < 0x80 {
2997  				v = uint64(b[0])
2998  				n = 1
2999  			} else if len(b) >= 2 && b[1] < 128 {
3000  				v = uint64(b[0]&0x7f) + uint64(b[1])<<7
3001  				n = 2
3002  			} else {
3003  				v, n = protowire.ConsumeVarint(b)
3004  			}
3005  			if n < 0 {
3006  				return protoreflect.Value{}, out, errDecode
3007  			}
3008  			list.Append(protoreflect.ValueOfUint64(v))
3009  			b = b[n:]
3010  		}
3011  		out.n = n
3012  		return listv, out, nil
3013  	}
3014  	if wtyp != protowire.VarintType {
3015  		return protoreflect.Value{}, out, errUnknown
3016  	}
3017  	var v uint64
3018  	var n int
3019  	if len(b) >= 1 && b[0] < 0x80 {
3020  		v = uint64(b[0])
3021  		n = 1
3022  	} else if len(b) >= 2 && b[1] < 128 {
3023  		v = uint64(b[0]&0x7f) + uint64(b[1])<<7
3024  		n = 2
3025  	} else {
3026  		v, n = protowire.ConsumeVarint(b)
3027  	}
3028  	if n < 0 {
3029  		return protoreflect.Value{}, out, errDecode
3030  	}
3031  	list.Append(protoreflect.ValueOfUint64(v))
3032  	out.n = n
3033  	return listv, out, nil
3034  }
3035  
3036  var coderUint64SliceValue = valueCoderFuncs{
3037  	size:      sizeUint64SliceValue,
3038  	marshal:   appendUint64SliceValue,
3039  	unmarshal: consumeUint64SliceValue,
3040  	merge:     mergeListValue,
3041  }
3042  
3043  // sizeUint64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Uint64.
3044  func sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3045  	list := listv.List()
3046  	llen := list.Len()
3047  	if llen == 0 {
3048  		return 0
3049  	}
3050  	n := 0
3051  	for i, llen := 0, llen; i < llen; i++ {
3052  		v := list.Get(i)
3053  		n += protowire.SizeVarint(v.Uint())
3054  	}
3055  	return tagsize + protowire.SizeBytes(n)
3056  }
3057  
3058  // appendUint64PackedSliceValue encodes a []uint64 value as a packed repeated Uint64.
3059  func appendUint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3060  	list := listv.List()
3061  	llen := list.Len()
3062  	if llen == 0 {
3063  		return b, nil
3064  	}
3065  	b = protowire.AppendVarint(b, wiretag)
3066  	n := 0
3067  	for i := 0; i < llen; i++ {
3068  		v := list.Get(i)
3069  		n += protowire.SizeVarint(v.Uint())
3070  	}
3071  	b = protowire.AppendVarint(b, uint64(n))
3072  	for i := 0; i < llen; i++ {
3073  		v := list.Get(i)
3074  		b = protowire.AppendVarint(b, v.Uint())
3075  	}
3076  	return b, nil
3077  }
3078  
3079  var coderUint64PackedSliceValue = valueCoderFuncs{
3080  	size:      sizeUint64PackedSliceValue,
3081  	marshal:   appendUint64PackedSliceValue,
3082  	unmarshal: consumeUint64SliceValue,
3083  	merge:     mergeListValue,
3084  }
3085  
3086  // sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.
3087  func sizeSfixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3088  
3089  	return f.tagsize + protowire.SizeFixed32()
3090  }
3091  
3092  // appendSfixed32 wire encodes a int32 pointer as a Sfixed32.
3093  func appendSfixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3094  	v := *p.Int32()
3095  	b = protowire.AppendVarint(b, f.wiretag)
3096  	b = protowire.AppendFixed32(b, uint32(v))
3097  	return b, nil
3098  }
3099  
3100  // consumeSfixed32 wire decodes a int32 pointer as a Sfixed32.
3101  func consumeSfixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3102  	if wtyp != protowire.Fixed32Type {
3103  		return out, errUnknown
3104  	}
3105  	v, n := protowire.ConsumeFixed32(b)
3106  	if n < 0 {
3107  		return out, errDecode
3108  	}
3109  	*p.Int32() = int32(v)
3110  	out.n = n
3111  	return out, nil
3112  }
3113  
3114  var coderSfixed32 = pointerCoderFuncs{
3115  	size:      sizeSfixed32,
3116  	marshal:   appendSfixed32,
3117  	unmarshal: consumeSfixed32,
3118  	merge:     mergeInt32,
3119  }
3120  
3121  // sizeSfixed32NoZero returns the size of wire encoding a int32 pointer as a Sfixed32.
3122  // The zero value is not encoded.
3123  func sizeSfixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3124  	v := *p.Int32()
3125  	if v == 0 {
3126  		return 0
3127  	}
3128  	return f.tagsize + protowire.SizeFixed32()
3129  }
3130  
3131  // appendSfixed32NoZero wire encodes a int32 pointer as a Sfixed32.
3132  // The zero value is not encoded.
3133  func appendSfixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3134  	v := *p.Int32()
3135  	if v == 0 {
3136  		return b, nil
3137  	}
3138  	b = protowire.AppendVarint(b, f.wiretag)
3139  	b = protowire.AppendFixed32(b, uint32(v))
3140  	return b, nil
3141  }
3142  
3143  var coderSfixed32NoZero = pointerCoderFuncs{
3144  	size:      sizeSfixed32NoZero,
3145  	marshal:   appendSfixed32NoZero,
3146  	unmarshal: consumeSfixed32,
3147  	merge:     mergeInt32NoZero,
3148  }
3149  
3150  // sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32.
3151  // It panics if the pointer is nil.
3152  func sizeSfixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3153  	return f.tagsize + protowire.SizeFixed32()
3154  }
3155  
3156  // appendSfixed32Ptr wire encodes a *int32 pointer as a Sfixed32.
3157  // It panics if the pointer is nil.
3158  func appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3159  	v := **p.Int32Ptr()
3160  	b = protowire.AppendVarint(b, f.wiretag)
3161  	b = protowire.AppendFixed32(b, uint32(v))
3162  	return b, nil
3163  }
3164  
3165  // consumeSfixed32Ptr wire decodes a *int32 pointer as a Sfixed32.
3166  func consumeSfixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3167  	if wtyp != protowire.Fixed32Type {
3168  		return out, errUnknown
3169  	}
3170  	v, n := protowire.ConsumeFixed32(b)
3171  	if n < 0 {
3172  		return out, errDecode
3173  	}
3174  	vp := p.Int32Ptr()
3175  	if *vp == nil {
3176  		*vp = new(int32)
3177  	}
3178  	**vp = int32(v)
3179  	out.n = n
3180  	return out, nil
3181  }
3182  
3183  var coderSfixed32Ptr = pointerCoderFuncs{
3184  	size:      sizeSfixed32Ptr,
3185  	marshal:   appendSfixed32Ptr,
3186  	unmarshal: consumeSfixed32Ptr,
3187  	merge:     mergeInt32Ptr,
3188  }
3189  
3190  // sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32.
3191  func sizeSfixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3192  	s := *p.Int32Slice()
3193  	size = len(s) * (f.tagsize + protowire.SizeFixed32())
3194  	return size
3195  }
3196  
3197  // appendSfixed32Slice encodes a []int32 pointer as a repeated Sfixed32.
3198  func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3199  	s := *p.Int32Slice()
3200  	for _, v := range s {
3201  		b = protowire.AppendVarint(b, f.wiretag)
3202  		b = protowire.AppendFixed32(b, uint32(v))
3203  	}
3204  	return b, nil
3205  }
3206  
3207  // consumeSfixed32Slice wire decodes a []int32 pointer as a repeated Sfixed32.
3208  func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3209  	sp := p.Int32Slice()
3210  	if wtyp == protowire.BytesType {
3211  		b, n := protowire.ConsumeBytes(b)
3212  		if n < 0 {
3213  			return out, errDecode
3214  		}
3215  		count := len(b) / protowire.SizeFixed32()
3216  		if count > 0 {
3217  			p.growInt32Slice(count)
3218  		}
3219  		s := *sp
3220  		for len(b) > 0 {
3221  			v, n := protowire.ConsumeFixed32(b)
3222  			if n < 0 {
3223  				return out, errDecode
3224  			}
3225  			s = append(s, int32(v))
3226  			b = b[n:]
3227  		}
3228  		*sp = s
3229  		out.n = n
3230  		return out, nil
3231  	}
3232  	if wtyp != protowire.Fixed32Type {
3233  		return out, errUnknown
3234  	}
3235  	v, n := protowire.ConsumeFixed32(b)
3236  	if n < 0 {
3237  		return out, errDecode
3238  	}
3239  	*sp = append(*sp, int32(v))
3240  	out.n = n
3241  	return out, nil
3242  }
3243  
3244  var coderSfixed32Slice = pointerCoderFuncs{
3245  	size:      sizeSfixed32Slice,
3246  	marshal:   appendSfixed32Slice,
3247  	unmarshal: consumeSfixed32Slice,
3248  	merge:     mergeInt32Slice,
3249  }
3250  
3251  // sizeSfixed32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sfixed32.
3252  func sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3253  	s := *p.Int32Slice()
3254  	if len(s) == 0 {
3255  		return 0
3256  	}
3257  	n := len(s) * protowire.SizeFixed32()
3258  	return f.tagsize + protowire.SizeBytes(n)
3259  }
3260  
3261  // appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32.
3262  func appendSfixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3263  	s := *p.Int32Slice()
3264  	if len(s) == 0 {
3265  		return b, nil
3266  	}
3267  	b = protowire.AppendVarint(b, f.wiretag)
3268  	n := len(s) * protowire.SizeFixed32()
3269  	b = protowire.AppendVarint(b, uint64(n))
3270  	for _, v := range s {
3271  		b = protowire.AppendFixed32(b, uint32(v))
3272  	}
3273  	return b, nil
3274  }
3275  
3276  var coderSfixed32PackedSlice = pointerCoderFuncs{
3277  	size:      sizeSfixed32PackedSlice,
3278  	marshal:   appendSfixed32PackedSlice,
3279  	unmarshal: consumeSfixed32Slice,
3280  	merge:     mergeInt32Slice,
3281  }
3282  
3283  // sizeSfixed32Value returns the size of wire encoding a int32 value as a Sfixed32.
3284  func sizeSfixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
3285  	return tagsize + protowire.SizeFixed32()
3286  }
3287  
3288  // appendSfixed32Value encodes a int32 value as a Sfixed32.
3289  func appendSfixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3290  	b = protowire.AppendVarint(b, wiretag)
3291  	b = protowire.AppendFixed32(b, uint32(v.Int()))
3292  	return b, nil
3293  }
3294  
3295  // consumeSfixed32Value decodes a int32 value as a Sfixed32.
3296  func consumeSfixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
3297  	if wtyp != protowire.Fixed32Type {
3298  		return protoreflect.Value{}, out, errUnknown
3299  	}
3300  	v, n := protowire.ConsumeFixed32(b)
3301  	if n < 0 {
3302  		return protoreflect.Value{}, out, errDecode
3303  	}
3304  	out.n = n
3305  	return protoreflect.ValueOfInt32(int32(v)), out, nil
3306  }
3307  
3308  var coderSfixed32Value = valueCoderFuncs{
3309  	size:      sizeSfixed32Value,
3310  	marshal:   appendSfixed32Value,
3311  	unmarshal: consumeSfixed32Value,
3312  	merge:     mergeScalarValue,
3313  }
3314  
3315  // sizeSfixed32SliceValue returns the size of wire encoding a []int32 value as a repeated Sfixed32.
3316  func sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3317  	list := listv.List()
3318  	size = list.Len() * (tagsize + protowire.SizeFixed32())
3319  	return size
3320  }
3321  
3322  // appendSfixed32SliceValue encodes a []int32 value as a repeated Sfixed32.
3323  func appendSfixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3324  	list := listv.List()
3325  	for i, llen := 0, list.Len(); i < llen; i++ {
3326  		v := list.Get(i)
3327  		b = protowire.AppendVarint(b, wiretag)
3328  		b = protowire.AppendFixed32(b, uint32(v.Int()))
3329  	}
3330  	return b, nil
3331  }
3332  
3333  // consumeSfixed32SliceValue wire decodes a []int32 value as a repeated Sfixed32.
3334  func consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
3335  	list := listv.List()
3336  	if wtyp == protowire.BytesType {
3337  		b, n := protowire.ConsumeBytes(b)
3338  		if n < 0 {
3339  			return protoreflect.Value{}, out, errDecode
3340  		}
3341  		for len(b) > 0 {
3342  			v, n := protowire.ConsumeFixed32(b)
3343  			if n < 0 {
3344  				return protoreflect.Value{}, out, errDecode
3345  			}
3346  			list.Append(protoreflect.ValueOfInt32(int32(v)))
3347  			b = b[n:]
3348  		}
3349  		out.n = n
3350  		return listv, out, nil
3351  	}
3352  	if wtyp != protowire.Fixed32Type {
3353  		return protoreflect.Value{}, out, errUnknown
3354  	}
3355  	v, n := protowire.ConsumeFixed32(b)
3356  	if n < 0 {
3357  		return protoreflect.Value{}, out, errDecode
3358  	}
3359  	list.Append(protoreflect.ValueOfInt32(int32(v)))
3360  	out.n = n
3361  	return listv, out, nil
3362  }
3363  
3364  var coderSfixed32SliceValue = valueCoderFuncs{
3365  	size:      sizeSfixed32SliceValue,
3366  	marshal:   appendSfixed32SliceValue,
3367  	unmarshal: consumeSfixed32SliceValue,
3368  	merge:     mergeListValue,
3369  }
3370  
3371  // sizeSfixed32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sfixed32.
3372  func sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3373  	list := listv.List()
3374  	llen := list.Len()
3375  	if llen == 0 {
3376  		return 0
3377  	}
3378  	n := llen * protowire.SizeFixed32()
3379  	return tagsize + protowire.SizeBytes(n)
3380  }
3381  
3382  // appendSfixed32PackedSliceValue encodes a []int32 value as a packed repeated Sfixed32.
3383  func appendSfixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3384  	list := listv.List()
3385  	llen := list.Len()
3386  	if llen == 0 {
3387  		return b, nil
3388  	}
3389  	b = protowire.AppendVarint(b, wiretag)
3390  	n := llen * protowire.SizeFixed32()
3391  	b = protowire.AppendVarint(b, uint64(n))
3392  	for i := 0; i < llen; i++ {
3393  		v := list.Get(i)
3394  		b = protowire.AppendFixed32(b, uint32(v.Int()))
3395  	}
3396  	return b, nil
3397  }
3398  
3399  var coderSfixed32PackedSliceValue = valueCoderFuncs{
3400  	size:      sizeSfixed32PackedSliceValue,
3401  	marshal:   appendSfixed32PackedSliceValue,
3402  	unmarshal: consumeSfixed32SliceValue,
3403  	merge:     mergeListValue,
3404  }
3405  
3406  // sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.
3407  func sizeFixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3408  
3409  	return f.tagsize + protowire.SizeFixed32()
3410  }
3411  
3412  // appendFixed32 wire encodes a uint32 pointer as a Fixed32.
3413  func appendFixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3414  	v := *p.Uint32()
3415  	b = protowire.AppendVarint(b, f.wiretag)
3416  	b = protowire.AppendFixed32(b, v)
3417  	return b, nil
3418  }
3419  
3420  // consumeFixed32 wire decodes a uint32 pointer as a Fixed32.
3421  func consumeFixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3422  	if wtyp != protowire.Fixed32Type {
3423  		return out, errUnknown
3424  	}
3425  	v, n := protowire.ConsumeFixed32(b)
3426  	if n < 0 {
3427  		return out, errDecode
3428  	}
3429  	*p.Uint32() = v
3430  	out.n = n
3431  	return out, nil
3432  }
3433  
3434  var coderFixed32 = pointerCoderFuncs{
3435  	size:      sizeFixed32,
3436  	marshal:   appendFixed32,
3437  	unmarshal: consumeFixed32,
3438  	merge:     mergeUint32,
3439  }
3440  
3441  // sizeFixed32NoZero returns the size of wire encoding a uint32 pointer as a Fixed32.
3442  // The zero value is not encoded.
3443  func sizeFixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3444  	v := *p.Uint32()
3445  	if v == 0 {
3446  		return 0
3447  	}
3448  	return f.tagsize + protowire.SizeFixed32()
3449  }
3450  
3451  // appendFixed32NoZero wire encodes a uint32 pointer as a Fixed32.
3452  // The zero value is not encoded.
3453  func appendFixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3454  	v := *p.Uint32()
3455  	if v == 0 {
3456  		return b, nil
3457  	}
3458  	b = protowire.AppendVarint(b, f.wiretag)
3459  	b = protowire.AppendFixed32(b, v)
3460  	return b, nil
3461  }
3462  
3463  var coderFixed32NoZero = pointerCoderFuncs{
3464  	size:      sizeFixed32NoZero,
3465  	marshal:   appendFixed32NoZero,
3466  	unmarshal: consumeFixed32,
3467  	merge:     mergeUint32NoZero,
3468  }
3469  
3470  // sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32.
3471  // It panics if the pointer is nil.
3472  func sizeFixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3473  	return f.tagsize + protowire.SizeFixed32()
3474  }
3475  
3476  // appendFixed32Ptr wire encodes a *uint32 pointer as a Fixed32.
3477  // It panics if the pointer is nil.
3478  func appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3479  	v := **p.Uint32Ptr()
3480  	b = protowire.AppendVarint(b, f.wiretag)
3481  	b = protowire.AppendFixed32(b, v)
3482  	return b, nil
3483  }
3484  
3485  // consumeFixed32Ptr wire decodes a *uint32 pointer as a Fixed32.
3486  func consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3487  	if wtyp != protowire.Fixed32Type {
3488  		return out, errUnknown
3489  	}
3490  	v, n := protowire.ConsumeFixed32(b)
3491  	if n < 0 {
3492  		return out, errDecode
3493  	}
3494  	vp := p.Uint32Ptr()
3495  	if *vp == nil {
3496  		*vp = new(uint32)
3497  	}
3498  	**vp = v
3499  	out.n = n
3500  	return out, nil
3501  }
3502  
3503  var coderFixed32Ptr = pointerCoderFuncs{
3504  	size:      sizeFixed32Ptr,
3505  	marshal:   appendFixed32Ptr,
3506  	unmarshal: consumeFixed32Ptr,
3507  	merge:     mergeUint32Ptr,
3508  }
3509  
3510  // sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32.
3511  func sizeFixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3512  	s := *p.Uint32Slice()
3513  	size = len(s) * (f.tagsize + protowire.SizeFixed32())
3514  	return size
3515  }
3516  
3517  // appendFixed32Slice encodes a []uint32 pointer as a repeated Fixed32.
3518  func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3519  	s := *p.Uint32Slice()
3520  	for _, v := range s {
3521  		b = protowire.AppendVarint(b, f.wiretag)
3522  		b = protowire.AppendFixed32(b, v)
3523  	}
3524  	return b, nil
3525  }
3526  
3527  // consumeFixed32Slice wire decodes a []uint32 pointer as a repeated Fixed32.
3528  func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3529  	sp := p.Uint32Slice()
3530  	if wtyp == protowire.BytesType {
3531  		b, n := protowire.ConsumeBytes(b)
3532  		if n < 0 {
3533  			return out, errDecode
3534  		}
3535  		count := len(b) / protowire.SizeFixed32()
3536  		if count > 0 {
3537  			p.growUint32Slice(count)
3538  		}
3539  		s := *sp
3540  		for len(b) > 0 {
3541  			v, n := protowire.ConsumeFixed32(b)
3542  			if n < 0 {
3543  				return out, errDecode
3544  			}
3545  			s = append(s, v)
3546  			b = b[n:]
3547  		}
3548  		*sp = s
3549  		out.n = n
3550  		return out, nil
3551  	}
3552  	if wtyp != protowire.Fixed32Type {
3553  		return out, errUnknown
3554  	}
3555  	v, n := protowire.ConsumeFixed32(b)
3556  	if n < 0 {
3557  		return out, errDecode
3558  	}
3559  	*sp = append(*sp, v)
3560  	out.n = n
3561  	return out, nil
3562  }
3563  
3564  var coderFixed32Slice = pointerCoderFuncs{
3565  	size:      sizeFixed32Slice,
3566  	marshal:   appendFixed32Slice,
3567  	unmarshal: consumeFixed32Slice,
3568  	merge:     mergeUint32Slice,
3569  }
3570  
3571  // sizeFixed32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Fixed32.
3572  func sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3573  	s := *p.Uint32Slice()
3574  	if len(s) == 0 {
3575  		return 0
3576  	}
3577  	n := len(s) * protowire.SizeFixed32()
3578  	return f.tagsize + protowire.SizeBytes(n)
3579  }
3580  
3581  // appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32.
3582  func appendFixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3583  	s := *p.Uint32Slice()
3584  	if len(s) == 0 {
3585  		return b, nil
3586  	}
3587  	b = protowire.AppendVarint(b, f.wiretag)
3588  	n := len(s) * protowire.SizeFixed32()
3589  	b = protowire.AppendVarint(b, uint64(n))
3590  	for _, v := range s {
3591  		b = protowire.AppendFixed32(b, v)
3592  	}
3593  	return b, nil
3594  }
3595  
3596  var coderFixed32PackedSlice = pointerCoderFuncs{
3597  	size:      sizeFixed32PackedSlice,
3598  	marshal:   appendFixed32PackedSlice,
3599  	unmarshal: consumeFixed32Slice,
3600  	merge:     mergeUint32Slice,
3601  }
3602  
3603  // sizeFixed32Value returns the size of wire encoding a uint32 value as a Fixed32.
3604  func sizeFixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
3605  	return tagsize + protowire.SizeFixed32()
3606  }
3607  
3608  // appendFixed32Value encodes a uint32 value as a Fixed32.
3609  func appendFixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3610  	b = protowire.AppendVarint(b, wiretag)
3611  	b = protowire.AppendFixed32(b, uint32(v.Uint()))
3612  	return b, nil
3613  }
3614  
3615  // consumeFixed32Value decodes a uint32 value as a Fixed32.
3616  func consumeFixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
3617  	if wtyp != protowire.Fixed32Type {
3618  		return protoreflect.Value{}, out, errUnknown
3619  	}
3620  	v, n := protowire.ConsumeFixed32(b)
3621  	if n < 0 {
3622  		return protoreflect.Value{}, out, errDecode
3623  	}
3624  	out.n = n
3625  	return protoreflect.ValueOfUint32(uint32(v)), out, nil
3626  }
3627  
3628  var coderFixed32Value = valueCoderFuncs{
3629  	size:      sizeFixed32Value,
3630  	marshal:   appendFixed32Value,
3631  	unmarshal: consumeFixed32Value,
3632  	merge:     mergeScalarValue,
3633  }
3634  
3635  // sizeFixed32SliceValue returns the size of wire encoding a []uint32 value as a repeated Fixed32.
3636  func sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3637  	list := listv.List()
3638  	size = list.Len() * (tagsize + protowire.SizeFixed32())
3639  	return size
3640  }
3641  
3642  // appendFixed32SliceValue encodes a []uint32 value as a repeated Fixed32.
3643  func appendFixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3644  	list := listv.List()
3645  	for i, llen := 0, list.Len(); i < llen; i++ {
3646  		v := list.Get(i)
3647  		b = protowire.AppendVarint(b, wiretag)
3648  		b = protowire.AppendFixed32(b, uint32(v.Uint()))
3649  	}
3650  	return b, nil
3651  }
3652  
3653  // consumeFixed32SliceValue wire decodes a []uint32 value as a repeated Fixed32.
3654  func consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
3655  	list := listv.List()
3656  	if wtyp == protowire.BytesType {
3657  		b, n := protowire.ConsumeBytes(b)
3658  		if n < 0 {
3659  			return protoreflect.Value{}, out, errDecode
3660  		}
3661  		for len(b) > 0 {
3662  			v, n := protowire.ConsumeFixed32(b)
3663  			if n < 0 {
3664  				return protoreflect.Value{}, out, errDecode
3665  			}
3666  			list.Append(protoreflect.ValueOfUint32(uint32(v)))
3667  			b = b[n:]
3668  		}
3669  		out.n = n
3670  		return listv, out, nil
3671  	}
3672  	if wtyp != protowire.Fixed32Type {
3673  		return protoreflect.Value{}, out, errUnknown
3674  	}
3675  	v, n := protowire.ConsumeFixed32(b)
3676  	if n < 0 {
3677  		return protoreflect.Value{}, out, errDecode
3678  	}
3679  	list.Append(protoreflect.ValueOfUint32(uint32(v)))
3680  	out.n = n
3681  	return listv, out, nil
3682  }
3683  
3684  var coderFixed32SliceValue = valueCoderFuncs{
3685  	size:      sizeFixed32SliceValue,
3686  	marshal:   appendFixed32SliceValue,
3687  	unmarshal: consumeFixed32SliceValue,
3688  	merge:     mergeListValue,
3689  }
3690  
3691  // sizeFixed32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Fixed32.
3692  func sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3693  	list := listv.List()
3694  	llen := list.Len()
3695  	if llen == 0 {
3696  		return 0
3697  	}
3698  	n := llen * protowire.SizeFixed32()
3699  	return tagsize + protowire.SizeBytes(n)
3700  }
3701  
3702  // appendFixed32PackedSliceValue encodes a []uint32 value as a packed repeated Fixed32.
3703  func appendFixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3704  	list := listv.List()
3705  	llen := list.Len()
3706  	if llen == 0 {
3707  		return b, nil
3708  	}
3709  	b = protowire.AppendVarint(b, wiretag)
3710  	n := llen * protowire.SizeFixed32()
3711  	b = protowire.AppendVarint(b, uint64(n))
3712  	for i := 0; i < llen; i++ {
3713  		v := list.Get(i)
3714  		b = protowire.AppendFixed32(b, uint32(v.Uint()))
3715  	}
3716  	return b, nil
3717  }
3718  
3719  var coderFixed32PackedSliceValue = valueCoderFuncs{
3720  	size:      sizeFixed32PackedSliceValue,
3721  	marshal:   appendFixed32PackedSliceValue,
3722  	unmarshal: consumeFixed32SliceValue,
3723  	merge:     mergeListValue,
3724  }
3725  
3726  // sizeFloat returns the size of wire encoding a float32 pointer as a Float.
3727  func sizeFloat(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3728  
3729  	return f.tagsize + protowire.SizeFixed32()
3730  }
3731  
3732  // appendFloat wire encodes a float32 pointer as a Float.
3733  func appendFloat(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3734  	v := *p.Float32()
3735  	b = protowire.AppendVarint(b, f.wiretag)
3736  	b = protowire.AppendFixed32(b, math.Float32bits(v))
3737  	return b, nil
3738  }
3739  
3740  // consumeFloat wire decodes a float32 pointer as a Float.
3741  func consumeFloat(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3742  	if wtyp != protowire.Fixed32Type {
3743  		return out, errUnknown
3744  	}
3745  	v, n := protowire.ConsumeFixed32(b)
3746  	if n < 0 {
3747  		return out, errDecode
3748  	}
3749  	*p.Float32() = math.Float32frombits(v)
3750  	out.n = n
3751  	return out, nil
3752  }
3753  
3754  var coderFloat = pointerCoderFuncs{
3755  	size:      sizeFloat,
3756  	marshal:   appendFloat,
3757  	unmarshal: consumeFloat,
3758  	merge:     mergeFloat32,
3759  }
3760  
3761  // sizeFloatNoZero returns the size of wire encoding a float32 pointer as a Float.
3762  // The zero value is not encoded.
3763  func sizeFloatNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3764  	v := *p.Float32()
3765  	if v == 0 && !math.Signbit(float64(v)) {
3766  		return 0
3767  	}
3768  	return f.tagsize + protowire.SizeFixed32()
3769  }
3770  
3771  // appendFloatNoZero wire encodes a float32 pointer as a Float.
3772  // The zero value is not encoded.
3773  func appendFloatNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3774  	v := *p.Float32()
3775  	if v == 0 && !math.Signbit(float64(v)) {
3776  		return b, nil
3777  	}
3778  	b = protowire.AppendVarint(b, f.wiretag)
3779  	b = protowire.AppendFixed32(b, math.Float32bits(v))
3780  	return b, nil
3781  }
3782  
3783  var coderFloatNoZero = pointerCoderFuncs{
3784  	size:      sizeFloatNoZero,
3785  	marshal:   appendFloatNoZero,
3786  	unmarshal: consumeFloat,
3787  	merge:     mergeFloat32NoZero,
3788  }
3789  
3790  // sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float.
3791  // It panics if the pointer is nil.
3792  func sizeFloatPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3793  	return f.tagsize + protowire.SizeFixed32()
3794  }
3795  
3796  // appendFloatPtr wire encodes a *float32 pointer as a Float.
3797  // It panics if the pointer is nil.
3798  func appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3799  	v := **p.Float32Ptr()
3800  	b = protowire.AppendVarint(b, f.wiretag)
3801  	b = protowire.AppendFixed32(b, math.Float32bits(v))
3802  	return b, nil
3803  }
3804  
3805  // consumeFloatPtr wire decodes a *float32 pointer as a Float.
3806  func consumeFloatPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3807  	if wtyp != protowire.Fixed32Type {
3808  		return out, errUnknown
3809  	}
3810  	v, n := protowire.ConsumeFixed32(b)
3811  	if n < 0 {
3812  		return out, errDecode
3813  	}
3814  	vp := p.Float32Ptr()
3815  	if *vp == nil {
3816  		*vp = new(float32)
3817  	}
3818  	**vp = math.Float32frombits(v)
3819  	out.n = n
3820  	return out, nil
3821  }
3822  
3823  var coderFloatPtr = pointerCoderFuncs{
3824  	size:      sizeFloatPtr,
3825  	marshal:   appendFloatPtr,
3826  	unmarshal: consumeFloatPtr,
3827  	merge:     mergeFloat32Ptr,
3828  }
3829  
3830  // sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float.
3831  func sizeFloatSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3832  	s := *p.Float32Slice()
3833  	size = len(s) * (f.tagsize + protowire.SizeFixed32())
3834  	return size
3835  }
3836  
3837  // appendFloatSlice encodes a []float32 pointer as a repeated Float.
3838  func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3839  	s := *p.Float32Slice()
3840  	for _, v := range s {
3841  		b = protowire.AppendVarint(b, f.wiretag)
3842  		b = protowire.AppendFixed32(b, math.Float32bits(v))
3843  	}
3844  	return b, nil
3845  }
3846  
3847  // consumeFloatSlice wire decodes a []float32 pointer as a repeated Float.
3848  func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
3849  	sp := p.Float32Slice()
3850  	if wtyp == protowire.BytesType {
3851  		b, n := protowire.ConsumeBytes(b)
3852  		if n < 0 {
3853  			return out, errDecode
3854  		}
3855  		count := len(b) / protowire.SizeFixed32()
3856  		if count > 0 {
3857  			p.growFloat32Slice(count)
3858  		}
3859  		s := *sp
3860  		for len(b) > 0 {
3861  			v, n := protowire.ConsumeFixed32(b)
3862  			if n < 0 {
3863  				return out, errDecode
3864  			}
3865  			s = append(s, math.Float32frombits(v))
3866  			b = b[n:]
3867  		}
3868  		*sp = s
3869  		out.n = n
3870  		return out, nil
3871  	}
3872  	if wtyp != protowire.Fixed32Type {
3873  		return out, errUnknown
3874  	}
3875  	v, n := protowire.ConsumeFixed32(b)
3876  	if n < 0 {
3877  		return out, errDecode
3878  	}
3879  	*sp = append(*sp, math.Float32frombits(v))
3880  	out.n = n
3881  	return out, nil
3882  }
3883  
3884  var coderFloatSlice = pointerCoderFuncs{
3885  	size:      sizeFloatSlice,
3886  	marshal:   appendFloatSlice,
3887  	unmarshal: consumeFloatSlice,
3888  	merge:     mergeFloat32Slice,
3889  }
3890  
3891  // sizeFloatPackedSlice returns the size of wire encoding a []float32 pointer as a packed repeated Float.
3892  func sizeFloatPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3893  	s := *p.Float32Slice()
3894  	if len(s) == 0 {
3895  		return 0
3896  	}
3897  	n := len(s) * protowire.SizeFixed32()
3898  	return f.tagsize + protowire.SizeBytes(n)
3899  }
3900  
3901  // appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float.
3902  func appendFloatPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3903  	s := *p.Float32Slice()
3904  	if len(s) == 0 {
3905  		return b, nil
3906  	}
3907  	b = protowire.AppendVarint(b, f.wiretag)
3908  	n := len(s) * protowire.SizeFixed32()
3909  	b = protowire.AppendVarint(b, uint64(n))
3910  	for _, v := range s {
3911  		b = protowire.AppendFixed32(b, math.Float32bits(v))
3912  	}
3913  	return b, nil
3914  }
3915  
3916  var coderFloatPackedSlice = pointerCoderFuncs{
3917  	size:      sizeFloatPackedSlice,
3918  	marshal:   appendFloatPackedSlice,
3919  	unmarshal: consumeFloatSlice,
3920  	merge:     mergeFloat32Slice,
3921  }
3922  
3923  // sizeFloatValue returns the size of wire encoding a float32 value as a Float.
3924  func sizeFloatValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
3925  	return tagsize + protowire.SizeFixed32()
3926  }
3927  
3928  // appendFloatValue encodes a float32 value as a Float.
3929  func appendFloatValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3930  	b = protowire.AppendVarint(b, wiretag)
3931  	b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
3932  	return b, nil
3933  }
3934  
3935  // consumeFloatValue decodes a float32 value as a Float.
3936  func consumeFloatValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
3937  	if wtyp != protowire.Fixed32Type {
3938  		return protoreflect.Value{}, out, errUnknown
3939  	}
3940  	v, n := protowire.ConsumeFixed32(b)
3941  	if n < 0 {
3942  		return protoreflect.Value{}, out, errDecode
3943  	}
3944  	out.n = n
3945  	return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), out, nil
3946  }
3947  
3948  var coderFloatValue = valueCoderFuncs{
3949  	size:      sizeFloatValue,
3950  	marshal:   appendFloatValue,
3951  	unmarshal: consumeFloatValue,
3952  	merge:     mergeScalarValue,
3953  }
3954  
3955  // sizeFloatSliceValue returns the size of wire encoding a []float32 value as a repeated Float.
3956  func sizeFloatSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3957  	list := listv.List()
3958  	size = list.Len() * (tagsize + protowire.SizeFixed32())
3959  	return size
3960  }
3961  
3962  // appendFloatSliceValue encodes a []float32 value as a repeated Float.
3963  func appendFloatSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3964  	list := listv.List()
3965  	for i, llen := 0, list.Len(); i < llen; i++ {
3966  		v := list.Get(i)
3967  		b = protowire.AppendVarint(b, wiretag)
3968  		b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
3969  	}
3970  	return b, nil
3971  }
3972  
3973  // consumeFloatSliceValue wire decodes a []float32 value as a repeated Float.
3974  func consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
3975  	list := listv.List()
3976  	if wtyp == protowire.BytesType {
3977  		b, n := protowire.ConsumeBytes(b)
3978  		if n < 0 {
3979  			return protoreflect.Value{}, out, errDecode
3980  		}
3981  		for len(b) > 0 {
3982  			v, n := protowire.ConsumeFixed32(b)
3983  			if n < 0 {
3984  				return protoreflect.Value{}, out, errDecode
3985  			}
3986  			list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
3987  			b = b[n:]
3988  		}
3989  		out.n = n
3990  		return listv, out, nil
3991  	}
3992  	if wtyp != protowire.Fixed32Type {
3993  		return protoreflect.Value{}, out, errUnknown
3994  	}
3995  	v, n := protowire.ConsumeFixed32(b)
3996  	if n < 0 {
3997  		return protoreflect.Value{}, out, errDecode
3998  	}
3999  	list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
4000  	out.n = n
4001  	return listv, out, nil
4002  }
4003  
4004  var coderFloatSliceValue = valueCoderFuncs{
4005  	size:      sizeFloatSliceValue,
4006  	marshal:   appendFloatSliceValue,
4007  	unmarshal: consumeFloatSliceValue,
4008  	merge:     mergeListValue,
4009  }
4010  
4011  // sizeFloatPackedSliceValue returns the size of wire encoding a []float32 value as a packed repeated Float.
4012  func sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4013  	list := listv.List()
4014  	llen := list.Len()
4015  	if llen == 0 {
4016  		return 0
4017  	}
4018  	n := llen * protowire.SizeFixed32()
4019  	return tagsize + protowire.SizeBytes(n)
4020  }
4021  
4022  // appendFloatPackedSliceValue encodes a []float32 value as a packed repeated Float.
4023  func appendFloatPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4024  	list := listv.List()
4025  	llen := list.Len()
4026  	if llen == 0 {
4027  		return b, nil
4028  	}
4029  	b = protowire.AppendVarint(b, wiretag)
4030  	n := llen * protowire.SizeFixed32()
4031  	b = protowire.AppendVarint(b, uint64(n))
4032  	for i := 0; i < llen; i++ {
4033  		v := list.Get(i)
4034  		b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
4035  	}
4036  	return b, nil
4037  }
4038  
4039  var coderFloatPackedSliceValue = valueCoderFuncs{
4040  	size:      sizeFloatPackedSliceValue,
4041  	marshal:   appendFloatPackedSliceValue,
4042  	unmarshal: consumeFloatSliceValue,
4043  	merge:     mergeListValue,
4044  }
4045  
4046  // sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.
4047  func sizeSfixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4048  
4049  	return f.tagsize + protowire.SizeFixed64()
4050  }
4051  
4052  // appendSfixed64 wire encodes a int64 pointer as a Sfixed64.
4053  func appendSfixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4054  	v := *p.Int64()
4055  	b = protowire.AppendVarint(b, f.wiretag)
4056  	b = protowire.AppendFixed64(b, uint64(v))
4057  	return b, nil
4058  }
4059  
4060  // consumeSfixed64 wire decodes a int64 pointer as a Sfixed64.
4061  func consumeSfixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4062  	if wtyp != protowire.Fixed64Type {
4063  		return out, errUnknown
4064  	}
4065  	v, n := protowire.ConsumeFixed64(b)
4066  	if n < 0 {
4067  		return out, errDecode
4068  	}
4069  	*p.Int64() = int64(v)
4070  	out.n = n
4071  	return out, nil
4072  }
4073  
4074  var coderSfixed64 = pointerCoderFuncs{
4075  	size:      sizeSfixed64,
4076  	marshal:   appendSfixed64,
4077  	unmarshal: consumeSfixed64,
4078  	merge:     mergeInt64,
4079  }
4080  
4081  // sizeSfixed64NoZero returns the size of wire encoding a int64 pointer as a Sfixed64.
4082  // The zero value is not encoded.
4083  func sizeSfixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4084  	v := *p.Int64()
4085  	if v == 0 {
4086  		return 0
4087  	}
4088  	return f.tagsize + protowire.SizeFixed64()
4089  }
4090  
4091  // appendSfixed64NoZero wire encodes a int64 pointer as a Sfixed64.
4092  // The zero value is not encoded.
4093  func appendSfixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4094  	v := *p.Int64()
4095  	if v == 0 {
4096  		return b, nil
4097  	}
4098  	b = protowire.AppendVarint(b, f.wiretag)
4099  	b = protowire.AppendFixed64(b, uint64(v))
4100  	return b, nil
4101  }
4102  
4103  var coderSfixed64NoZero = pointerCoderFuncs{
4104  	size:      sizeSfixed64NoZero,
4105  	marshal:   appendSfixed64NoZero,
4106  	unmarshal: consumeSfixed64,
4107  	merge:     mergeInt64NoZero,
4108  }
4109  
4110  // sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64.
4111  // It panics if the pointer is nil.
4112  func sizeSfixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4113  	return f.tagsize + protowire.SizeFixed64()
4114  }
4115  
4116  // appendSfixed64Ptr wire encodes a *int64 pointer as a Sfixed64.
4117  // It panics if the pointer is nil.
4118  func appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4119  	v := **p.Int64Ptr()
4120  	b = protowire.AppendVarint(b, f.wiretag)
4121  	b = protowire.AppendFixed64(b, uint64(v))
4122  	return b, nil
4123  }
4124  
4125  // consumeSfixed64Ptr wire decodes a *int64 pointer as a Sfixed64.
4126  func consumeSfixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4127  	if wtyp != protowire.Fixed64Type {
4128  		return out, errUnknown
4129  	}
4130  	v, n := protowire.ConsumeFixed64(b)
4131  	if n < 0 {
4132  		return out, errDecode
4133  	}
4134  	vp := p.Int64Ptr()
4135  	if *vp == nil {
4136  		*vp = new(int64)
4137  	}
4138  	**vp = int64(v)
4139  	out.n = n
4140  	return out, nil
4141  }
4142  
4143  var coderSfixed64Ptr = pointerCoderFuncs{
4144  	size:      sizeSfixed64Ptr,
4145  	marshal:   appendSfixed64Ptr,
4146  	unmarshal: consumeSfixed64Ptr,
4147  	merge:     mergeInt64Ptr,
4148  }
4149  
4150  // sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64.
4151  func sizeSfixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4152  	s := *p.Int64Slice()
4153  	size = len(s) * (f.tagsize + protowire.SizeFixed64())
4154  	return size
4155  }
4156  
4157  // appendSfixed64Slice encodes a []int64 pointer as a repeated Sfixed64.
4158  func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4159  	s := *p.Int64Slice()
4160  	for _, v := range s {
4161  		b = protowire.AppendVarint(b, f.wiretag)
4162  		b = protowire.AppendFixed64(b, uint64(v))
4163  	}
4164  	return b, nil
4165  }
4166  
4167  // consumeSfixed64Slice wire decodes a []int64 pointer as a repeated Sfixed64.
4168  func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4169  	sp := p.Int64Slice()
4170  	if wtyp == protowire.BytesType {
4171  		b, n := protowire.ConsumeBytes(b)
4172  		if n < 0 {
4173  			return out, errDecode
4174  		}
4175  		count := len(b) / protowire.SizeFixed64()
4176  		if count > 0 {
4177  			p.growInt64Slice(count)
4178  		}
4179  		s := *sp
4180  		for len(b) > 0 {
4181  			v, n := protowire.ConsumeFixed64(b)
4182  			if n < 0 {
4183  				return out, errDecode
4184  			}
4185  			s = append(s, int64(v))
4186  			b = b[n:]
4187  		}
4188  		*sp = s
4189  		out.n = n
4190  		return out, nil
4191  	}
4192  	if wtyp != protowire.Fixed64Type {
4193  		return out, errUnknown
4194  	}
4195  	v, n := protowire.ConsumeFixed64(b)
4196  	if n < 0 {
4197  		return out, errDecode
4198  	}
4199  	*sp = append(*sp, int64(v))
4200  	out.n = n
4201  	return out, nil
4202  }
4203  
4204  var coderSfixed64Slice = pointerCoderFuncs{
4205  	size:      sizeSfixed64Slice,
4206  	marshal:   appendSfixed64Slice,
4207  	unmarshal: consumeSfixed64Slice,
4208  	merge:     mergeInt64Slice,
4209  }
4210  
4211  // sizeSfixed64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sfixed64.
4212  func sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4213  	s := *p.Int64Slice()
4214  	if len(s) == 0 {
4215  		return 0
4216  	}
4217  	n := len(s) * protowire.SizeFixed64()
4218  	return f.tagsize + protowire.SizeBytes(n)
4219  }
4220  
4221  // appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64.
4222  func appendSfixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4223  	s := *p.Int64Slice()
4224  	if len(s) == 0 {
4225  		return b, nil
4226  	}
4227  	b = protowire.AppendVarint(b, f.wiretag)
4228  	n := len(s) * protowire.SizeFixed64()
4229  	b = protowire.AppendVarint(b, uint64(n))
4230  	for _, v := range s {
4231  		b = protowire.AppendFixed64(b, uint64(v))
4232  	}
4233  	return b, nil
4234  }
4235  
4236  var coderSfixed64PackedSlice = pointerCoderFuncs{
4237  	size:      sizeSfixed64PackedSlice,
4238  	marshal:   appendSfixed64PackedSlice,
4239  	unmarshal: consumeSfixed64Slice,
4240  	merge:     mergeInt64Slice,
4241  }
4242  
4243  // sizeSfixed64Value returns the size of wire encoding a int64 value as a Sfixed64.
4244  func sizeSfixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
4245  	return tagsize + protowire.SizeFixed64()
4246  }
4247  
4248  // appendSfixed64Value encodes a int64 value as a Sfixed64.
4249  func appendSfixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4250  	b = protowire.AppendVarint(b, wiretag)
4251  	b = protowire.AppendFixed64(b, uint64(v.Int()))
4252  	return b, nil
4253  }
4254  
4255  // consumeSfixed64Value decodes a int64 value as a Sfixed64.
4256  func consumeSfixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
4257  	if wtyp != protowire.Fixed64Type {
4258  		return protoreflect.Value{}, out, errUnknown
4259  	}
4260  	v, n := protowire.ConsumeFixed64(b)
4261  	if n < 0 {
4262  		return protoreflect.Value{}, out, errDecode
4263  	}
4264  	out.n = n
4265  	return protoreflect.ValueOfInt64(int64(v)), out, nil
4266  }
4267  
4268  var coderSfixed64Value = valueCoderFuncs{
4269  	size:      sizeSfixed64Value,
4270  	marshal:   appendSfixed64Value,
4271  	unmarshal: consumeSfixed64Value,
4272  	merge:     mergeScalarValue,
4273  }
4274  
4275  // sizeSfixed64SliceValue returns the size of wire encoding a []int64 value as a repeated Sfixed64.
4276  func sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4277  	list := listv.List()
4278  	size = list.Len() * (tagsize + protowire.SizeFixed64())
4279  	return size
4280  }
4281  
4282  // appendSfixed64SliceValue encodes a []int64 value as a repeated Sfixed64.
4283  func appendSfixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4284  	list := listv.List()
4285  	for i, llen := 0, list.Len(); i < llen; i++ {
4286  		v := list.Get(i)
4287  		b = protowire.AppendVarint(b, wiretag)
4288  		b = protowire.AppendFixed64(b, uint64(v.Int()))
4289  	}
4290  	return b, nil
4291  }
4292  
4293  // consumeSfixed64SliceValue wire decodes a []int64 value as a repeated Sfixed64.
4294  func consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
4295  	list := listv.List()
4296  	if wtyp == protowire.BytesType {
4297  		b, n := protowire.ConsumeBytes(b)
4298  		if n < 0 {
4299  			return protoreflect.Value{}, out, errDecode
4300  		}
4301  		for len(b) > 0 {
4302  			v, n := protowire.ConsumeFixed64(b)
4303  			if n < 0 {
4304  				return protoreflect.Value{}, out, errDecode
4305  			}
4306  			list.Append(protoreflect.ValueOfInt64(int64(v)))
4307  			b = b[n:]
4308  		}
4309  		out.n = n
4310  		return listv, out, nil
4311  	}
4312  	if wtyp != protowire.Fixed64Type {
4313  		return protoreflect.Value{}, out, errUnknown
4314  	}
4315  	v, n := protowire.ConsumeFixed64(b)
4316  	if n < 0 {
4317  		return protoreflect.Value{}, out, errDecode
4318  	}
4319  	list.Append(protoreflect.ValueOfInt64(int64(v)))
4320  	out.n = n
4321  	return listv, out, nil
4322  }
4323  
4324  var coderSfixed64SliceValue = valueCoderFuncs{
4325  	size:      sizeSfixed64SliceValue,
4326  	marshal:   appendSfixed64SliceValue,
4327  	unmarshal: consumeSfixed64SliceValue,
4328  	merge:     mergeListValue,
4329  }
4330  
4331  // sizeSfixed64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sfixed64.
4332  func sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4333  	list := listv.List()
4334  	llen := list.Len()
4335  	if llen == 0 {
4336  		return 0
4337  	}
4338  	n := llen * protowire.SizeFixed64()
4339  	return tagsize + protowire.SizeBytes(n)
4340  }
4341  
4342  // appendSfixed64PackedSliceValue encodes a []int64 value as a packed repeated Sfixed64.
4343  func appendSfixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4344  	list := listv.List()
4345  	llen := list.Len()
4346  	if llen == 0 {
4347  		return b, nil
4348  	}
4349  	b = protowire.AppendVarint(b, wiretag)
4350  	n := llen * protowire.SizeFixed64()
4351  	b = protowire.AppendVarint(b, uint64(n))
4352  	for i := 0; i < llen; i++ {
4353  		v := list.Get(i)
4354  		b = protowire.AppendFixed64(b, uint64(v.Int()))
4355  	}
4356  	return b, nil
4357  }
4358  
4359  var coderSfixed64PackedSliceValue = valueCoderFuncs{
4360  	size:      sizeSfixed64PackedSliceValue,
4361  	marshal:   appendSfixed64PackedSliceValue,
4362  	unmarshal: consumeSfixed64SliceValue,
4363  	merge:     mergeListValue,
4364  }
4365  
4366  // sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.
4367  func sizeFixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4368  
4369  	return f.tagsize + protowire.SizeFixed64()
4370  }
4371  
4372  // appendFixed64 wire encodes a uint64 pointer as a Fixed64.
4373  func appendFixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4374  	v := *p.Uint64()
4375  	b = protowire.AppendVarint(b, f.wiretag)
4376  	b = protowire.AppendFixed64(b, v)
4377  	return b, nil
4378  }
4379  
4380  // consumeFixed64 wire decodes a uint64 pointer as a Fixed64.
4381  func consumeFixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4382  	if wtyp != protowire.Fixed64Type {
4383  		return out, errUnknown
4384  	}
4385  	v, n := protowire.ConsumeFixed64(b)
4386  	if n < 0 {
4387  		return out, errDecode
4388  	}
4389  	*p.Uint64() = v
4390  	out.n = n
4391  	return out, nil
4392  }
4393  
4394  var coderFixed64 = pointerCoderFuncs{
4395  	size:      sizeFixed64,
4396  	marshal:   appendFixed64,
4397  	unmarshal: consumeFixed64,
4398  	merge:     mergeUint64,
4399  }
4400  
4401  // sizeFixed64NoZero returns the size of wire encoding a uint64 pointer as a Fixed64.
4402  // The zero value is not encoded.
4403  func sizeFixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4404  	v := *p.Uint64()
4405  	if v == 0 {
4406  		return 0
4407  	}
4408  	return f.tagsize + protowire.SizeFixed64()
4409  }
4410  
4411  // appendFixed64NoZero wire encodes a uint64 pointer as a Fixed64.
4412  // The zero value is not encoded.
4413  func appendFixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4414  	v := *p.Uint64()
4415  	if v == 0 {
4416  		return b, nil
4417  	}
4418  	b = protowire.AppendVarint(b, f.wiretag)
4419  	b = protowire.AppendFixed64(b, v)
4420  	return b, nil
4421  }
4422  
4423  var coderFixed64NoZero = pointerCoderFuncs{
4424  	size:      sizeFixed64NoZero,
4425  	marshal:   appendFixed64NoZero,
4426  	unmarshal: consumeFixed64,
4427  	merge:     mergeUint64NoZero,
4428  }
4429  
4430  // sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64.
4431  // It panics if the pointer is nil.
4432  func sizeFixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4433  	return f.tagsize + protowire.SizeFixed64()
4434  }
4435  
4436  // appendFixed64Ptr wire encodes a *uint64 pointer as a Fixed64.
4437  // It panics if the pointer is nil.
4438  func appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4439  	v := **p.Uint64Ptr()
4440  	b = protowire.AppendVarint(b, f.wiretag)
4441  	b = protowire.AppendFixed64(b, v)
4442  	return b, nil
4443  }
4444  
4445  // consumeFixed64Ptr wire decodes a *uint64 pointer as a Fixed64.
4446  func consumeFixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4447  	if wtyp != protowire.Fixed64Type {
4448  		return out, errUnknown
4449  	}
4450  	v, n := protowire.ConsumeFixed64(b)
4451  	if n < 0 {
4452  		return out, errDecode
4453  	}
4454  	vp := p.Uint64Ptr()
4455  	if *vp == nil {
4456  		*vp = new(uint64)
4457  	}
4458  	**vp = v
4459  	out.n = n
4460  	return out, nil
4461  }
4462  
4463  var coderFixed64Ptr = pointerCoderFuncs{
4464  	size:      sizeFixed64Ptr,
4465  	marshal:   appendFixed64Ptr,
4466  	unmarshal: consumeFixed64Ptr,
4467  	merge:     mergeUint64Ptr,
4468  }
4469  
4470  // sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64.
4471  func sizeFixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4472  	s := *p.Uint64Slice()
4473  	size = len(s) * (f.tagsize + protowire.SizeFixed64())
4474  	return size
4475  }
4476  
4477  // appendFixed64Slice encodes a []uint64 pointer as a repeated Fixed64.
4478  func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4479  	s := *p.Uint64Slice()
4480  	for _, v := range s {
4481  		b = protowire.AppendVarint(b, f.wiretag)
4482  		b = protowire.AppendFixed64(b, v)
4483  	}
4484  	return b, nil
4485  }
4486  
4487  // consumeFixed64Slice wire decodes a []uint64 pointer as a repeated Fixed64.
4488  func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4489  	sp := p.Uint64Slice()
4490  	if wtyp == protowire.BytesType {
4491  		b, n := protowire.ConsumeBytes(b)
4492  		if n < 0 {
4493  			return out, errDecode
4494  		}
4495  		count := len(b) / protowire.SizeFixed64()
4496  		if count > 0 {
4497  			p.growUint64Slice(count)
4498  		}
4499  		s := *sp
4500  		for len(b) > 0 {
4501  			v, n := protowire.ConsumeFixed64(b)
4502  			if n < 0 {
4503  				return out, errDecode
4504  			}
4505  			s = append(s, v)
4506  			b = b[n:]
4507  		}
4508  		*sp = s
4509  		out.n = n
4510  		return out, nil
4511  	}
4512  	if wtyp != protowire.Fixed64Type {
4513  		return out, errUnknown
4514  	}
4515  	v, n := protowire.ConsumeFixed64(b)
4516  	if n < 0 {
4517  		return out, errDecode
4518  	}
4519  	*sp = append(*sp, v)
4520  	out.n = n
4521  	return out, nil
4522  }
4523  
4524  var coderFixed64Slice = pointerCoderFuncs{
4525  	size:      sizeFixed64Slice,
4526  	marshal:   appendFixed64Slice,
4527  	unmarshal: consumeFixed64Slice,
4528  	merge:     mergeUint64Slice,
4529  }
4530  
4531  // sizeFixed64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Fixed64.
4532  func sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4533  	s := *p.Uint64Slice()
4534  	if len(s) == 0 {
4535  		return 0
4536  	}
4537  	n := len(s) * protowire.SizeFixed64()
4538  	return f.tagsize + protowire.SizeBytes(n)
4539  }
4540  
4541  // appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64.
4542  func appendFixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4543  	s := *p.Uint64Slice()
4544  	if len(s) == 0 {
4545  		return b, nil
4546  	}
4547  	b = protowire.AppendVarint(b, f.wiretag)
4548  	n := len(s) * protowire.SizeFixed64()
4549  	b = protowire.AppendVarint(b, uint64(n))
4550  	for _, v := range s {
4551  		b = protowire.AppendFixed64(b, v)
4552  	}
4553  	return b, nil
4554  }
4555  
4556  var coderFixed64PackedSlice = pointerCoderFuncs{
4557  	size:      sizeFixed64PackedSlice,
4558  	marshal:   appendFixed64PackedSlice,
4559  	unmarshal: consumeFixed64Slice,
4560  	merge:     mergeUint64Slice,
4561  }
4562  
4563  // sizeFixed64Value returns the size of wire encoding a uint64 value as a Fixed64.
4564  func sizeFixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
4565  	return tagsize + protowire.SizeFixed64()
4566  }
4567  
4568  // appendFixed64Value encodes a uint64 value as a Fixed64.
4569  func appendFixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4570  	b = protowire.AppendVarint(b, wiretag)
4571  	b = protowire.AppendFixed64(b, v.Uint())
4572  	return b, nil
4573  }
4574  
4575  // consumeFixed64Value decodes a uint64 value as a Fixed64.
4576  func consumeFixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
4577  	if wtyp != protowire.Fixed64Type {
4578  		return protoreflect.Value{}, out, errUnknown
4579  	}
4580  	v, n := protowire.ConsumeFixed64(b)
4581  	if n < 0 {
4582  		return protoreflect.Value{}, out, errDecode
4583  	}
4584  	out.n = n
4585  	return protoreflect.ValueOfUint64(v), out, nil
4586  }
4587  
4588  var coderFixed64Value = valueCoderFuncs{
4589  	size:      sizeFixed64Value,
4590  	marshal:   appendFixed64Value,
4591  	unmarshal: consumeFixed64Value,
4592  	merge:     mergeScalarValue,
4593  }
4594  
4595  // sizeFixed64SliceValue returns the size of wire encoding a []uint64 value as a repeated Fixed64.
4596  func sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4597  	list := listv.List()
4598  	size = list.Len() * (tagsize + protowire.SizeFixed64())
4599  	return size
4600  }
4601  
4602  // appendFixed64SliceValue encodes a []uint64 value as a repeated Fixed64.
4603  func appendFixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4604  	list := listv.List()
4605  	for i, llen := 0, list.Len(); i < llen; i++ {
4606  		v := list.Get(i)
4607  		b = protowire.AppendVarint(b, wiretag)
4608  		b = protowire.AppendFixed64(b, v.Uint())
4609  	}
4610  	return b, nil
4611  }
4612  
4613  // consumeFixed64SliceValue wire decodes a []uint64 value as a repeated Fixed64.
4614  func consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
4615  	list := listv.List()
4616  	if wtyp == protowire.BytesType {
4617  		b, n := protowire.ConsumeBytes(b)
4618  		if n < 0 {
4619  			return protoreflect.Value{}, out, errDecode
4620  		}
4621  		for len(b) > 0 {
4622  			v, n := protowire.ConsumeFixed64(b)
4623  			if n < 0 {
4624  				return protoreflect.Value{}, out, errDecode
4625  			}
4626  			list.Append(protoreflect.ValueOfUint64(v))
4627  			b = b[n:]
4628  		}
4629  		out.n = n
4630  		return listv, out, nil
4631  	}
4632  	if wtyp != protowire.Fixed64Type {
4633  		return protoreflect.Value{}, out, errUnknown
4634  	}
4635  	v, n := protowire.ConsumeFixed64(b)
4636  	if n < 0 {
4637  		return protoreflect.Value{}, out, errDecode
4638  	}
4639  	list.Append(protoreflect.ValueOfUint64(v))
4640  	out.n = n
4641  	return listv, out, nil
4642  }
4643  
4644  var coderFixed64SliceValue = valueCoderFuncs{
4645  	size:      sizeFixed64SliceValue,
4646  	marshal:   appendFixed64SliceValue,
4647  	unmarshal: consumeFixed64SliceValue,
4648  	merge:     mergeListValue,
4649  }
4650  
4651  // sizeFixed64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Fixed64.
4652  func sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4653  	list := listv.List()
4654  	llen := list.Len()
4655  	if llen == 0 {
4656  		return 0
4657  	}
4658  	n := llen * protowire.SizeFixed64()
4659  	return tagsize + protowire.SizeBytes(n)
4660  }
4661  
4662  // appendFixed64PackedSliceValue encodes a []uint64 value as a packed repeated Fixed64.
4663  func appendFixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4664  	list := listv.List()
4665  	llen := list.Len()
4666  	if llen == 0 {
4667  		return b, nil
4668  	}
4669  	b = protowire.AppendVarint(b, wiretag)
4670  	n := llen * protowire.SizeFixed64()
4671  	b = protowire.AppendVarint(b, uint64(n))
4672  	for i := 0; i < llen; i++ {
4673  		v := list.Get(i)
4674  		b = protowire.AppendFixed64(b, v.Uint())
4675  	}
4676  	return b, nil
4677  }
4678  
4679  var coderFixed64PackedSliceValue = valueCoderFuncs{
4680  	size:      sizeFixed64PackedSliceValue,
4681  	marshal:   appendFixed64PackedSliceValue,
4682  	unmarshal: consumeFixed64SliceValue,
4683  	merge:     mergeListValue,
4684  }
4685  
4686  // sizeDouble returns the size of wire encoding a float64 pointer as a Double.
4687  func sizeDouble(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4688  
4689  	return f.tagsize + protowire.SizeFixed64()
4690  }
4691  
4692  // appendDouble wire encodes a float64 pointer as a Double.
4693  func appendDouble(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4694  	v := *p.Float64()
4695  	b = protowire.AppendVarint(b, f.wiretag)
4696  	b = protowire.AppendFixed64(b, math.Float64bits(v))
4697  	return b, nil
4698  }
4699  
4700  // consumeDouble wire decodes a float64 pointer as a Double.
4701  func consumeDouble(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4702  	if wtyp != protowire.Fixed64Type {
4703  		return out, errUnknown
4704  	}
4705  	v, n := protowire.ConsumeFixed64(b)
4706  	if n < 0 {
4707  		return out, errDecode
4708  	}
4709  	*p.Float64() = math.Float64frombits(v)
4710  	out.n = n
4711  	return out, nil
4712  }
4713  
4714  var coderDouble = pointerCoderFuncs{
4715  	size:      sizeDouble,
4716  	marshal:   appendDouble,
4717  	unmarshal: consumeDouble,
4718  	merge:     mergeFloat64,
4719  }
4720  
4721  // sizeDoubleNoZero returns the size of wire encoding a float64 pointer as a Double.
4722  // The zero value is not encoded.
4723  func sizeDoubleNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4724  	v := *p.Float64()
4725  	if v == 0 && !math.Signbit(float64(v)) {
4726  		return 0
4727  	}
4728  	return f.tagsize + protowire.SizeFixed64()
4729  }
4730  
4731  // appendDoubleNoZero wire encodes a float64 pointer as a Double.
4732  // The zero value is not encoded.
4733  func appendDoubleNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4734  	v := *p.Float64()
4735  	if v == 0 && !math.Signbit(float64(v)) {
4736  		return b, nil
4737  	}
4738  	b = protowire.AppendVarint(b, f.wiretag)
4739  	b = protowire.AppendFixed64(b, math.Float64bits(v))
4740  	return b, nil
4741  }
4742  
4743  var coderDoubleNoZero = pointerCoderFuncs{
4744  	size:      sizeDoubleNoZero,
4745  	marshal:   appendDoubleNoZero,
4746  	unmarshal: consumeDouble,
4747  	merge:     mergeFloat64NoZero,
4748  }
4749  
4750  // sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double.
4751  // It panics if the pointer is nil.
4752  func sizeDoublePtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4753  	return f.tagsize + protowire.SizeFixed64()
4754  }
4755  
4756  // appendDoublePtr wire encodes a *float64 pointer as a Double.
4757  // It panics if the pointer is nil.
4758  func appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4759  	v := **p.Float64Ptr()
4760  	b = protowire.AppendVarint(b, f.wiretag)
4761  	b = protowire.AppendFixed64(b, math.Float64bits(v))
4762  	return b, nil
4763  }
4764  
4765  // consumeDoublePtr wire decodes a *float64 pointer as a Double.
4766  func consumeDoublePtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4767  	if wtyp != protowire.Fixed64Type {
4768  		return out, errUnknown
4769  	}
4770  	v, n := protowire.ConsumeFixed64(b)
4771  	if n < 0 {
4772  		return out, errDecode
4773  	}
4774  	vp := p.Float64Ptr()
4775  	if *vp == nil {
4776  		*vp = new(float64)
4777  	}
4778  	**vp = math.Float64frombits(v)
4779  	out.n = n
4780  	return out, nil
4781  }
4782  
4783  var coderDoublePtr = pointerCoderFuncs{
4784  	size:      sizeDoublePtr,
4785  	marshal:   appendDoublePtr,
4786  	unmarshal: consumeDoublePtr,
4787  	merge:     mergeFloat64Ptr,
4788  }
4789  
4790  // sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double.
4791  func sizeDoubleSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4792  	s := *p.Float64Slice()
4793  	size = len(s) * (f.tagsize + protowire.SizeFixed64())
4794  	return size
4795  }
4796  
4797  // appendDoubleSlice encodes a []float64 pointer as a repeated Double.
4798  func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4799  	s := *p.Float64Slice()
4800  	for _, v := range s {
4801  		b = protowire.AppendVarint(b, f.wiretag)
4802  		b = protowire.AppendFixed64(b, math.Float64bits(v))
4803  	}
4804  	return b, nil
4805  }
4806  
4807  // consumeDoubleSlice wire decodes a []float64 pointer as a repeated Double.
4808  func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
4809  	sp := p.Float64Slice()
4810  	if wtyp == protowire.BytesType {
4811  		b, n := protowire.ConsumeBytes(b)
4812  		if n < 0 {
4813  			return out, errDecode
4814  		}
4815  		count := len(b) / protowire.SizeFixed64()
4816  		if count > 0 {
4817  			p.growFloat64Slice(count)
4818  		}
4819  		s := *sp
4820  		for len(b) > 0 {
4821  			v, n := protowire.ConsumeFixed64(b)
4822  			if n < 0 {
4823  				return out, errDecode
4824  			}
4825  			s = append(s, math.Float64frombits(v))
4826  			b = b[n:]
4827  		}
4828  		*sp = s
4829  		out.n = n
4830  		return out, nil
4831  	}
4832  	if wtyp != protowire.Fixed64Type {
4833  		return out, errUnknown
4834  	}
4835  	v, n := protowire.ConsumeFixed64(b)
4836  	if n < 0 {
4837  		return out, errDecode
4838  	}
4839  	*sp = append(*sp, math.Float64frombits(v))
4840  	out.n = n
4841  	return out, nil
4842  }
4843  
4844  var coderDoubleSlice = pointerCoderFuncs{
4845  	size:      sizeDoubleSlice,
4846  	marshal:   appendDoubleSlice,
4847  	unmarshal: consumeDoubleSlice,
4848  	merge:     mergeFloat64Slice,
4849  }
4850  
4851  // sizeDoublePackedSlice returns the size of wire encoding a []float64 pointer as a packed repeated Double.
4852  func sizeDoublePackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4853  	s := *p.Float64Slice()
4854  	if len(s) == 0 {
4855  		return 0
4856  	}
4857  	n := len(s) * protowire.SizeFixed64()
4858  	return f.tagsize + protowire.SizeBytes(n)
4859  }
4860  
4861  // appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double.
4862  func appendDoublePackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4863  	s := *p.Float64Slice()
4864  	if len(s) == 0 {
4865  		return b, nil
4866  	}
4867  	b = protowire.AppendVarint(b, f.wiretag)
4868  	n := len(s) * protowire.SizeFixed64()
4869  	b = protowire.AppendVarint(b, uint64(n))
4870  	for _, v := range s {
4871  		b = protowire.AppendFixed64(b, math.Float64bits(v))
4872  	}
4873  	return b, nil
4874  }
4875  
4876  var coderDoublePackedSlice = pointerCoderFuncs{
4877  	size:      sizeDoublePackedSlice,
4878  	marshal:   appendDoublePackedSlice,
4879  	unmarshal: consumeDoubleSlice,
4880  	merge:     mergeFloat64Slice,
4881  }
4882  
4883  // sizeDoubleValue returns the size of wire encoding a float64 value as a Double.
4884  func sizeDoubleValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
4885  	return tagsize + protowire.SizeFixed64()
4886  }
4887  
4888  // appendDoubleValue encodes a float64 value as a Double.
4889  func appendDoubleValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4890  	b = protowire.AppendVarint(b, wiretag)
4891  	b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
4892  	return b, nil
4893  }
4894  
4895  // consumeDoubleValue decodes a float64 value as a Double.
4896  func consumeDoubleValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
4897  	if wtyp != protowire.Fixed64Type {
4898  		return protoreflect.Value{}, out, errUnknown
4899  	}
4900  	v, n := protowire.ConsumeFixed64(b)
4901  	if n < 0 {
4902  		return protoreflect.Value{}, out, errDecode
4903  	}
4904  	out.n = n
4905  	return protoreflect.ValueOfFloat64(math.Float64frombits(v)), out, nil
4906  }
4907  
4908  var coderDoubleValue = valueCoderFuncs{
4909  	size:      sizeDoubleValue,
4910  	marshal:   appendDoubleValue,
4911  	unmarshal: consumeDoubleValue,
4912  	merge:     mergeScalarValue,
4913  }
4914  
4915  // sizeDoubleSliceValue returns the size of wire encoding a []float64 value as a repeated Double.
4916  func sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4917  	list := listv.List()
4918  	size = list.Len() * (tagsize + protowire.SizeFixed64())
4919  	return size
4920  }
4921  
4922  // appendDoubleSliceValue encodes a []float64 value as a repeated Double.
4923  func appendDoubleSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4924  	list := listv.List()
4925  	for i, llen := 0, list.Len(); i < llen; i++ {
4926  		v := list.Get(i)
4927  		b = protowire.AppendVarint(b, wiretag)
4928  		b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
4929  	}
4930  	return b, nil
4931  }
4932  
4933  // consumeDoubleSliceValue wire decodes a []float64 value as a repeated Double.
4934  func consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
4935  	list := listv.List()
4936  	if wtyp == protowire.BytesType {
4937  		b, n := protowire.ConsumeBytes(b)
4938  		if n < 0 {
4939  			return protoreflect.Value{}, out, errDecode
4940  		}
4941  		for len(b) > 0 {
4942  			v, n := protowire.ConsumeFixed64(b)
4943  			if n < 0 {
4944  				return protoreflect.Value{}, out, errDecode
4945  			}
4946  			list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
4947  			b = b[n:]
4948  		}
4949  		out.n = n
4950  		return listv, out, nil
4951  	}
4952  	if wtyp != protowire.Fixed64Type {
4953  		return protoreflect.Value{}, out, errUnknown
4954  	}
4955  	v, n := protowire.ConsumeFixed64(b)
4956  	if n < 0 {
4957  		return protoreflect.Value{}, out, errDecode
4958  	}
4959  	list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
4960  	out.n = n
4961  	return listv, out, nil
4962  }
4963  
4964  var coderDoubleSliceValue = valueCoderFuncs{
4965  	size:      sizeDoubleSliceValue,
4966  	marshal:   appendDoubleSliceValue,
4967  	unmarshal: consumeDoubleSliceValue,
4968  	merge:     mergeListValue,
4969  }
4970  
4971  // sizeDoublePackedSliceValue returns the size of wire encoding a []float64 value as a packed repeated Double.
4972  func sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4973  	list := listv.List()
4974  	llen := list.Len()
4975  	if llen == 0 {
4976  		return 0
4977  	}
4978  	n := llen * protowire.SizeFixed64()
4979  	return tagsize + protowire.SizeBytes(n)
4980  }
4981  
4982  // appendDoublePackedSliceValue encodes a []float64 value as a packed repeated Double.
4983  func appendDoublePackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4984  	list := listv.List()
4985  	llen := list.Len()
4986  	if llen == 0 {
4987  		return b, nil
4988  	}
4989  	b = protowire.AppendVarint(b, wiretag)
4990  	n := llen * protowire.SizeFixed64()
4991  	b = protowire.AppendVarint(b, uint64(n))
4992  	for i := 0; i < llen; i++ {
4993  		v := list.Get(i)
4994  		b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
4995  	}
4996  	return b, nil
4997  }
4998  
4999  var coderDoublePackedSliceValue = valueCoderFuncs{
5000  	size:      sizeDoublePackedSliceValue,
5001  	marshal:   appendDoublePackedSliceValue,
5002  	unmarshal: consumeDoubleSliceValue,
5003  	merge:     mergeListValue,
5004  }
5005  
5006  // sizeString returns the size of wire encoding a string pointer as a String.
5007  func sizeString(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5008  	v := *p.String()
5009  	return f.tagsize + protowire.SizeBytes(len(v))
5010  }
5011  
5012  // appendString wire encodes a string pointer as a String.
5013  func appendString(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5014  	v := *p.String()
5015  	b = protowire.AppendVarint(b, f.wiretag)
5016  	b = protowire.AppendString(b, v)
5017  	return b, nil
5018  }
5019  
5020  // consumeString wire decodes a string pointer as a String.
5021  func consumeString(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5022  	if wtyp != protowire.BytesType {
5023  		return out, errUnknown
5024  	}
5025  	v, n := protowire.ConsumeBytes(b)
5026  	if n < 0 {
5027  		return out, errDecode
5028  	}
5029  	*p.String() = string(v)
5030  	out.n = n
5031  	return out, nil
5032  }
5033  
5034  var coderString = pointerCoderFuncs{
5035  	size:      sizeString,
5036  	marshal:   appendString,
5037  	unmarshal: consumeString,
5038  	merge:     mergeString,
5039  }
5040  
5041  // appendStringValidateUTF8 wire encodes a string pointer as a String.
5042  func appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5043  	v := *p.String()
5044  	b = protowire.AppendVarint(b, f.wiretag)
5045  	b = protowire.AppendString(b, v)
5046  	if !utf8.ValidString(v) {
5047  		return b, errInvalidUTF8{}
5048  	}
5049  	return b, nil
5050  }
5051  
5052  // consumeStringValidateUTF8 wire decodes a string pointer as a String.
5053  func consumeStringValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5054  	if wtyp != protowire.BytesType {
5055  		return out, errUnknown
5056  	}
5057  	v, n := protowire.ConsumeBytes(b)
5058  	if n < 0 {
5059  		return out, errDecode
5060  	}
5061  	if !utf8.Valid(v) {
5062  		return out, errInvalidUTF8{}
5063  	}
5064  	*p.String() = string(v)
5065  	out.n = n
5066  	return out, nil
5067  }
5068  
5069  var coderStringValidateUTF8 = pointerCoderFuncs{
5070  	size:      sizeString,
5071  	marshal:   appendStringValidateUTF8,
5072  	unmarshal: consumeStringValidateUTF8,
5073  	merge:     mergeString,
5074  }
5075  
5076  // sizeStringNoZero returns the size of wire encoding a string pointer as a String.
5077  // The zero value is not encoded.
5078  func sizeStringNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5079  	v := *p.String()
5080  	if len(v) == 0 {
5081  		return 0
5082  	}
5083  	return f.tagsize + protowire.SizeBytes(len(v))
5084  }
5085  
5086  // appendStringNoZero wire encodes a string pointer as a String.
5087  // The zero value is not encoded.
5088  func appendStringNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5089  	v := *p.String()
5090  	if len(v) == 0 {
5091  		return b, nil
5092  	}
5093  	b = protowire.AppendVarint(b, f.wiretag)
5094  	b = protowire.AppendString(b, v)
5095  	return b, nil
5096  }
5097  
5098  var coderStringNoZero = pointerCoderFuncs{
5099  	size:      sizeStringNoZero,
5100  	marshal:   appendStringNoZero,
5101  	unmarshal: consumeString,
5102  	merge:     mergeStringNoZero,
5103  }
5104  
5105  // appendStringNoZeroValidateUTF8 wire encodes a string pointer as a String.
5106  // The zero value is not encoded.
5107  func appendStringNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5108  	v := *p.String()
5109  	if len(v) == 0 {
5110  		return b, nil
5111  	}
5112  	b = protowire.AppendVarint(b, f.wiretag)
5113  	b = protowire.AppendString(b, v)
5114  	if !utf8.ValidString(v) {
5115  		return b, errInvalidUTF8{}
5116  	}
5117  	return b, nil
5118  }
5119  
5120  var coderStringNoZeroValidateUTF8 = pointerCoderFuncs{
5121  	size:      sizeStringNoZero,
5122  	marshal:   appendStringNoZeroValidateUTF8,
5123  	unmarshal: consumeStringValidateUTF8,
5124  	merge:     mergeStringNoZero,
5125  }
5126  
5127  // sizeStringPtr returns the size of wire encoding a *string pointer as a String.
5128  // It panics if the pointer is nil.
5129  func sizeStringPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5130  	v := **p.StringPtr()
5131  	return f.tagsize + protowire.SizeBytes(len(v))
5132  }
5133  
5134  // appendStringPtr wire encodes a *string pointer as a String.
5135  // It panics if the pointer is nil.
5136  func appendStringPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5137  	v := **p.StringPtr()
5138  	b = protowire.AppendVarint(b, f.wiretag)
5139  	b = protowire.AppendString(b, v)
5140  	return b, nil
5141  }
5142  
5143  // consumeStringPtr wire decodes a *string pointer as a String.
5144  func consumeStringPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5145  	if wtyp != protowire.BytesType {
5146  		return out, errUnknown
5147  	}
5148  	v, n := protowire.ConsumeBytes(b)
5149  	if n < 0 {
5150  		return out, errDecode
5151  	}
5152  	vp := p.StringPtr()
5153  	if *vp == nil {
5154  		*vp = new(string)
5155  	}
5156  	**vp = string(v)
5157  	out.n = n
5158  	return out, nil
5159  }
5160  
5161  var coderStringPtr = pointerCoderFuncs{
5162  	size:      sizeStringPtr,
5163  	marshal:   appendStringPtr,
5164  	unmarshal: consumeStringPtr,
5165  	merge:     mergeStringPtr,
5166  }
5167  
5168  // appendStringPtrValidateUTF8 wire encodes a *string pointer as a String.
5169  // It panics if the pointer is nil.
5170  func appendStringPtrValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5171  	v := **p.StringPtr()
5172  	b = protowire.AppendVarint(b, f.wiretag)
5173  	b = protowire.AppendString(b, v)
5174  	if !utf8.ValidString(v) {
5175  		return b, errInvalidUTF8{}
5176  	}
5177  	return b, nil
5178  }
5179  
5180  // consumeStringPtrValidateUTF8 wire decodes a *string pointer as a String.
5181  func consumeStringPtrValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5182  	if wtyp != protowire.BytesType {
5183  		return out, errUnknown
5184  	}
5185  	v, n := protowire.ConsumeBytes(b)
5186  	if n < 0 {
5187  		return out, errDecode
5188  	}
5189  	if !utf8.Valid(v) {
5190  		return out, errInvalidUTF8{}
5191  	}
5192  	vp := p.StringPtr()
5193  	if *vp == nil {
5194  		*vp = new(string)
5195  	}
5196  	**vp = string(v)
5197  	out.n = n
5198  	return out, nil
5199  }
5200  
5201  var coderStringPtrValidateUTF8 = pointerCoderFuncs{
5202  	size:      sizeStringPtr,
5203  	marshal:   appendStringPtrValidateUTF8,
5204  	unmarshal: consumeStringPtrValidateUTF8,
5205  	merge:     mergeStringPtr,
5206  }
5207  
5208  // sizeStringSlice returns the size of wire encoding a []string pointer as a repeated String.
5209  func sizeStringSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5210  	s := *p.StringSlice()
5211  	for _, v := range s {
5212  		size += f.tagsize + protowire.SizeBytes(len(v))
5213  	}
5214  	return size
5215  }
5216  
5217  // appendStringSlice encodes a []string pointer as a repeated String.
5218  func appendStringSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5219  	s := *p.StringSlice()
5220  	for _, v := range s {
5221  		b = protowire.AppendVarint(b, f.wiretag)
5222  		b = protowire.AppendString(b, v)
5223  	}
5224  	return b, nil
5225  }
5226  
5227  // consumeStringSlice wire decodes a []string pointer as a repeated String.
5228  func consumeStringSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5229  	sp := p.StringSlice()
5230  	if wtyp != protowire.BytesType {
5231  		return out, errUnknown
5232  	}
5233  	v, n := protowire.ConsumeBytes(b)
5234  	if n < 0 {
5235  		return out, errDecode
5236  	}
5237  	*sp = append(*sp, string(v))
5238  	out.n = n
5239  	return out, nil
5240  }
5241  
5242  var coderStringSlice = pointerCoderFuncs{
5243  	size:      sizeStringSlice,
5244  	marshal:   appendStringSlice,
5245  	unmarshal: consumeStringSlice,
5246  	merge:     mergeStringSlice,
5247  }
5248  
5249  // appendStringSliceValidateUTF8 encodes a []string pointer as a repeated String.
5250  func appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5251  	s := *p.StringSlice()
5252  	for _, v := range s {
5253  		b = protowire.AppendVarint(b, f.wiretag)
5254  		b = protowire.AppendString(b, v)
5255  		if !utf8.ValidString(v) {
5256  			return b, errInvalidUTF8{}
5257  		}
5258  	}
5259  	return b, nil
5260  }
5261  
5262  // consumeStringSliceValidateUTF8 wire decodes a []string pointer as a repeated String.
5263  func consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5264  	if wtyp != protowire.BytesType {
5265  		return out, errUnknown
5266  	}
5267  	v, n := protowire.ConsumeBytes(b)
5268  	if n < 0 {
5269  		return out, errDecode
5270  	}
5271  	if !utf8.Valid(v) {
5272  		return out, errInvalidUTF8{}
5273  	}
5274  	sp := p.StringSlice()
5275  	*sp = append(*sp, string(v))
5276  	out.n = n
5277  	return out, nil
5278  }
5279  
5280  var coderStringSliceValidateUTF8 = pointerCoderFuncs{
5281  	size:      sizeStringSlice,
5282  	marshal:   appendStringSliceValidateUTF8,
5283  	unmarshal: consumeStringSliceValidateUTF8,
5284  	merge:     mergeStringSlice,
5285  }
5286  
5287  // sizeStringValue returns the size of wire encoding a string value as a String.
5288  func sizeStringValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
5289  	return tagsize + protowire.SizeBytes(len(v.String()))
5290  }
5291  
5292  // appendStringValue encodes a string value as a String.
5293  func appendStringValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
5294  	b = protowire.AppendVarint(b, wiretag)
5295  	b = protowire.AppendString(b, v.String())
5296  	return b, nil
5297  }
5298  
5299  // consumeStringValue decodes a string value as a String.
5300  func consumeStringValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
5301  	if wtyp != protowire.BytesType {
5302  		return protoreflect.Value{}, out, errUnknown
5303  	}
5304  	v, n := protowire.ConsumeBytes(b)
5305  	if n < 0 {
5306  		return protoreflect.Value{}, out, errDecode
5307  	}
5308  	out.n = n
5309  	return protoreflect.ValueOfString(string(v)), out, nil
5310  }
5311  
5312  var coderStringValue = valueCoderFuncs{
5313  	size:      sizeStringValue,
5314  	marshal:   appendStringValue,
5315  	unmarshal: consumeStringValue,
5316  	merge:     mergeScalarValue,
5317  }
5318  
5319  // appendStringValueValidateUTF8 encodes a string value as a String.
5320  func appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
5321  	b = protowire.AppendVarint(b, wiretag)
5322  	b = protowire.AppendString(b, v.String())
5323  	if !utf8.ValidString(v.String()) {
5324  		return b, errInvalidUTF8{}
5325  	}
5326  	return b, nil
5327  }
5328  
5329  // consumeStringValueValidateUTF8 decodes a string value as a String.
5330  func consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
5331  	if wtyp != protowire.BytesType {
5332  		return protoreflect.Value{}, out, errUnknown
5333  	}
5334  	v, n := protowire.ConsumeBytes(b)
5335  	if n < 0 {
5336  		return protoreflect.Value{}, out, errDecode
5337  	}
5338  	if !utf8.Valid(v) {
5339  		return protoreflect.Value{}, out, errInvalidUTF8{}
5340  	}
5341  	out.n = n
5342  	return protoreflect.ValueOfString(string(v)), out, nil
5343  }
5344  
5345  var coderStringValueValidateUTF8 = valueCoderFuncs{
5346  	size:      sizeStringValue,
5347  	marshal:   appendStringValueValidateUTF8,
5348  	unmarshal: consumeStringValueValidateUTF8,
5349  	merge:     mergeScalarValue,
5350  }
5351  
5352  // sizeStringSliceValue returns the size of wire encoding a []string value as a repeated String.
5353  func sizeStringSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
5354  	list := listv.List()
5355  	for i, llen := 0, list.Len(); i < llen; i++ {
5356  		v := list.Get(i)
5357  		size += tagsize + protowire.SizeBytes(len(v.String()))
5358  	}
5359  	return size
5360  }
5361  
5362  // appendStringSliceValue encodes a []string value as a repeated String.
5363  func appendStringSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
5364  	list := listv.List()
5365  	for i, llen := 0, list.Len(); i < llen; i++ {
5366  		v := list.Get(i)
5367  		b = protowire.AppendVarint(b, wiretag)
5368  		b = protowire.AppendString(b, v.String())
5369  	}
5370  	return b, nil
5371  }
5372  
5373  // consumeStringSliceValue wire decodes a []string value as a repeated String.
5374  func consumeStringSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
5375  	list := listv.List()
5376  	if wtyp != protowire.BytesType {
5377  		return protoreflect.Value{}, out, errUnknown
5378  	}
5379  	v, n := protowire.ConsumeBytes(b)
5380  	if n < 0 {
5381  		return protoreflect.Value{}, out, errDecode
5382  	}
5383  	list.Append(protoreflect.ValueOfString(string(v)))
5384  	out.n = n
5385  	return listv, out, nil
5386  }
5387  
5388  var coderStringSliceValue = valueCoderFuncs{
5389  	size:      sizeStringSliceValue,
5390  	marshal:   appendStringSliceValue,
5391  	unmarshal: consumeStringSliceValue,
5392  	merge:     mergeListValue,
5393  }
5394  
5395  // sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.
5396  func sizeBytes(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5397  	v := *p.Bytes()
5398  	return f.tagsize + protowire.SizeBytes(len(v))
5399  }
5400  
5401  // appendBytes wire encodes a []byte pointer as a Bytes.
5402  func appendBytes(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5403  	v := *p.Bytes()
5404  	b = protowire.AppendVarint(b, f.wiretag)
5405  	b = protowire.AppendBytes(b, v)
5406  	return b, nil
5407  }
5408  
5409  // consumeBytes wire decodes a []byte pointer as a Bytes.
5410  func consumeBytes(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5411  	if wtyp != protowire.BytesType {
5412  		return out, errUnknown
5413  	}
5414  	v, n := protowire.ConsumeBytes(b)
5415  	if n < 0 {
5416  		return out, errDecode
5417  	}
5418  	*p.Bytes() = append(emptyBuf[:], v...)
5419  	out.n = n
5420  	return out, nil
5421  }
5422  
5423  var coderBytes = pointerCoderFuncs{
5424  	size:      sizeBytes,
5425  	marshal:   appendBytes,
5426  	unmarshal: consumeBytes,
5427  	merge:     mergeBytes,
5428  }
5429  
5430  // appendBytesValidateUTF8 wire encodes a []byte pointer as a Bytes.
5431  func appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5432  	v := *p.Bytes()
5433  	b = protowire.AppendVarint(b, f.wiretag)
5434  	b = protowire.AppendBytes(b, v)
5435  	if !utf8.Valid(v) {
5436  		return b, errInvalidUTF8{}
5437  	}
5438  	return b, nil
5439  }
5440  
5441  // consumeBytesValidateUTF8 wire decodes a []byte pointer as a Bytes.
5442  func consumeBytesValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5443  	if wtyp != protowire.BytesType {
5444  		return out, errUnknown
5445  	}
5446  	v, n := protowire.ConsumeBytes(b)
5447  	if n < 0 {
5448  		return out, errDecode
5449  	}
5450  	if !utf8.Valid(v) {
5451  		return out, errInvalidUTF8{}
5452  	}
5453  	*p.Bytes() = append(emptyBuf[:], v...)
5454  	out.n = n
5455  	return out, nil
5456  }
5457  
5458  var coderBytesValidateUTF8 = pointerCoderFuncs{
5459  	size:      sizeBytes,
5460  	marshal:   appendBytesValidateUTF8,
5461  	unmarshal: consumeBytesValidateUTF8,
5462  	merge:     mergeBytes,
5463  }
5464  
5465  // sizeBytesNoZero returns the size of wire encoding a []byte pointer as a Bytes.
5466  // The zero value is not encoded.
5467  func sizeBytesNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5468  	v := *p.Bytes()
5469  	if len(v) == 0 {
5470  		return 0
5471  	}
5472  	return f.tagsize + protowire.SizeBytes(len(v))
5473  }
5474  
5475  // appendBytesNoZero wire encodes a []byte pointer as a Bytes.
5476  // The zero value is not encoded.
5477  func appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5478  	v := *p.Bytes()
5479  	if len(v) == 0 {
5480  		return b, nil
5481  	}
5482  	b = protowire.AppendVarint(b, f.wiretag)
5483  	b = protowire.AppendBytes(b, v)
5484  	return b, nil
5485  }
5486  
5487  // consumeBytesNoZero wire decodes a []byte pointer as a Bytes.
5488  // The zero value is not decoded.
5489  func consumeBytesNoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5490  	if wtyp != protowire.BytesType {
5491  		return out, errUnknown
5492  	}
5493  	v, n := protowire.ConsumeBytes(b)
5494  	if n < 0 {
5495  		return out, errDecode
5496  	}
5497  	*p.Bytes() = append(([]byte)(nil), v...)
5498  	out.n = n
5499  	return out, nil
5500  }
5501  
5502  var coderBytesNoZero = pointerCoderFuncs{
5503  	size:      sizeBytesNoZero,
5504  	marshal:   appendBytesNoZero,
5505  	unmarshal: consumeBytesNoZero,
5506  	merge:     mergeBytesNoZero,
5507  }
5508  
5509  // appendBytesNoZeroValidateUTF8 wire encodes a []byte pointer as a Bytes.
5510  // The zero value is not encoded.
5511  func appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5512  	v := *p.Bytes()
5513  	if len(v) == 0 {
5514  		return b, nil
5515  	}
5516  	b = protowire.AppendVarint(b, f.wiretag)
5517  	b = protowire.AppendBytes(b, v)
5518  	if !utf8.Valid(v) {
5519  		return b, errInvalidUTF8{}
5520  	}
5521  	return b, nil
5522  }
5523  
5524  // consumeBytesNoZeroValidateUTF8 wire decodes a []byte pointer as a Bytes.
5525  func consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5526  	if wtyp != protowire.BytesType {
5527  		return out, errUnknown
5528  	}
5529  	v, n := protowire.ConsumeBytes(b)
5530  	if n < 0 {
5531  		return out, errDecode
5532  	}
5533  	if !utf8.Valid(v) {
5534  		return out, errInvalidUTF8{}
5535  	}
5536  	*p.Bytes() = append(([]byte)(nil), v...)
5537  	out.n = n
5538  	return out, nil
5539  }
5540  
5541  var coderBytesNoZeroValidateUTF8 = pointerCoderFuncs{
5542  	size:      sizeBytesNoZero,
5543  	marshal:   appendBytesNoZeroValidateUTF8,
5544  	unmarshal: consumeBytesNoZeroValidateUTF8,
5545  	merge:     mergeBytesNoZero,
5546  }
5547  
5548  // sizeBytesSlice returns the size of wire encoding a [][]byte pointer as a repeated Bytes.
5549  func sizeBytesSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5550  	s := *p.BytesSlice()
5551  	for _, v := range s {
5552  		size += f.tagsize + protowire.SizeBytes(len(v))
5553  	}
5554  	return size
5555  }
5556  
5557  // appendBytesSlice encodes a [][]byte pointer as a repeated Bytes.
5558  func appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5559  	s := *p.BytesSlice()
5560  	for _, v := range s {
5561  		b = protowire.AppendVarint(b, f.wiretag)
5562  		b = protowire.AppendBytes(b, v)
5563  	}
5564  	return b, nil
5565  }
5566  
5567  // consumeBytesSlice wire decodes a [][]byte pointer as a repeated Bytes.
5568  func consumeBytesSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5569  	sp := p.BytesSlice()
5570  	if wtyp != protowire.BytesType {
5571  		return out, errUnknown
5572  	}
5573  	v, n := protowire.ConsumeBytes(b)
5574  	if n < 0 {
5575  		return out, errDecode
5576  	}
5577  	*sp = append(*sp, append(emptyBuf[:], v...))
5578  	out.n = n
5579  	return out, nil
5580  }
5581  
5582  var coderBytesSlice = pointerCoderFuncs{
5583  	size:      sizeBytesSlice,
5584  	marshal:   appendBytesSlice,
5585  	unmarshal: consumeBytesSlice,
5586  	merge:     mergeBytesSlice,
5587  }
5588  
5589  // appendBytesSliceValidateUTF8 encodes a [][]byte pointer as a repeated Bytes.
5590  func appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5591  	s := *p.BytesSlice()
5592  	for _, v := range s {
5593  		b = protowire.AppendVarint(b, f.wiretag)
5594  		b = protowire.AppendBytes(b, v)
5595  		if !utf8.Valid(v) {
5596  			return b, errInvalidUTF8{}
5597  		}
5598  	}
5599  	return b, nil
5600  }
5601  
5602  // consumeBytesSliceValidateUTF8 wire decodes a [][]byte pointer as a repeated Bytes.
5603  func consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
5604  	if wtyp != protowire.BytesType {
5605  		return out, errUnknown
5606  	}
5607  	v, n := protowire.ConsumeBytes(b)
5608  	if n < 0 {
5609  		return out, errDecode
5610  	}
5611  	if !utf8.Valid(v) {
5612  		return out, errInvalidUTF8{}
5613  	}
5614  	sp := p.BytesSlice()
5615  	*sp = append(*sp, append(emptyBuf[:], v...))
5616  	out.n = n
5617  	return out, nil
5618  }
5619  
5620  var coderBytesSliceValidateUTF8 = pointerCoderFuncs{
5621  	size:      sizeBytesSlice,
5622  	marshal:   appendBytesSliceValidateUTF8,
5623  	unmarshal: consumeBytesSliceValidateUTF8,
5624  	merge:     mergeBytesSlice,
5625  }
5626  
5627  // sizeBytesValue returns the size of wire encoding a []byte value as a Bytes.
5628  func sizeBytesValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
5629  	return tagsize + protowire.SizeBytes(len(v.Bytes()))
5630  }
5631  
5632  // appendBytesValue encodes a []byte value as a Bytes.
5633  func appendBytesValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
5634  	b = protowire.AppendVarint(b, wiretag)
5635  	b = protowire.AppendBytes(b, v.Bytes())
5636  	return b, nil
5637  }
5638  
5639  // consumeBytesValue decodes a []byte value as a Bytes.
5640  func consumeBytesValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
5641  	if wtyp != protowire.BytesType {
5642  		return protoreflect.Value{}, out, errUnknown
5643  	}
5644  	v, n := protowire.ConsumeBytes(b)
5645  	if n < 0 {
5646  		return protoreflect.Value{}, out, errDecode
5647  	}
5648  	out.n = n
5649  	return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), out, nil
5650  }
5651  
5652  var coderBytesValue = valueCoderFuncs{
5653  	size:      sizeBytesValue,
5654  	marshal:   appendBytesValue,
5655  	unmarshal: consumeBytesValue,
5656  	merge:     mergeBytesValue,
5657  }
5658  
5659  // sizeBytesSliceValue returns the size of wire encoding a [][]byte value as a repeated Bytes.
5660  func sizeBytesSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
5661  	list := listv.List()
5662  	for i, llen := 0, list.Len(); i < llen; i++ {
5663  		v := list.Get(i)
5664  		size += tagsize + protowire.SizeBytes(len(v.Bytes()))
5665  	}
5666  	return size
5667  }
5668  
5669  // appendBytesSliceValue encodes a [][]byte value as a repeated Bytes.
5670  func appendBytesSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
5671  	list := listv.List()
5672  	for i, llen := 0, list.Len(); i < llen; i++ {
5673  		v := list.Get(i)
5674  		b = protowire.AppendVarint(b, wiretag)
5675  		b = protowire.AppendBytes(b, v.Bytes())
5676  	}
5677  	return b, nil
5678  }
5679  
5680  // consumeBytesSliceValue wire decodes a [][]byte value as a repeated Bytes.
5681  func consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
5682  	list := listv.List()
5683  	if wtyp != protowire.BytesType {
5684  		return protoreflect.Value{}, out, errUnknown
5685  	}
5686  	v, n := protowire.ConsumeBytes(b)
5687  	if n < 0 {
5688  		return protoreflect.Value{}, out, errDecode
5689  	}
5690  	list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))
5691  	out.n = n
5692  	return listv, out, nil
5693  }
5694  
5695  var coderBytesSliceValue = valueCoderFuncs{
5696  	size:      sizeBytesSliceValue,
5697  	marshal:   appendBytesSliceValue,
5698  	unmarshal: consumeBytesSliceValue,
5699  	merge:     mergeBytesListValue,
5700  }
5701  
5702  // We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.
5703  var emptyBuf [0]byte
5704  
5705  var wireTypes = map[protoreflect.Kind]protowire.Type{
5706  	protoreflect.BoolKind:     protowire.VarintType,
5707  	protoreflect.EnumKind:     protowire.VarintType,
5708  	protoreflect.Int32Kind:    protowire.VarintType,
5709  	protoreflect.Sint32Kind:   protowire.VarintType,
5710  	protoreflect.Uint32Kind:   protowire.VarintType,
5711  	protoreflect.Int64Kind:    protowire.VarintType,
5712  	protoreflect.Sint64Kind:   protowire.VarintType,
5713  	protoreflect.Uint64Kind:   protowire.VarintType,
5714  	protoreflect.Sfixed32Kind: protowire.Fixed32Type,
5715  	protoreflect.Fixed32Kind:  protowire.Fixed32Type,
5716  	protoreflect.FloatKind:    protowire.Fixed32Type,
5717  	protoreflect.Sfixed64Kind: protowire.Fixed64Type,
5718  	protoreflect.Fixed64Kind:  protowire.Fixed64Type,
5719  	protoreflect.DoubleKind:   protowire.Fixed64Type,
5720  	protoreflect.StringKind:   protowire.BytesType,
5721  	protoreflect.BytesKind:    protowire.BytesType,
5722  	protoreflect.MessageKind:  protowire.BytesType,
5723  	protoreflect.GroupKind:    protowire.StartGroupType,
5724  }
5725