13
"google.golang.org/protobuf/encoding/protowire"
14
"google.golang.org/protobuf/reflect/protoreflect"
18
func sizeBool(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
20
return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
24
func appendBool(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
26
b = protowire.AppendVarint(b, f.wiretag)
27
b = protowire.AppendVarint(b, protowire.EncodeBool(v))
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
38
if len(b) >= 1 && b[0] < 0x80 {
41
} else if len(b) >= 2 && b[1] < 128 {
42
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
45
v, n = protowire.ConsumeVarint(b)
50
*p.Bool() = protowire.DecodeBool(v)
55
var coderBool = pointerCoderFuncs{
58
unmarshal: consumeBool,
64
func sizeBoolNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
69
return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
74
func appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
79
b = protowire.AppendVarint(b, f.wiretag)
80
b = protowire.AppendVarint(b, protowire.EncodeBool(v))
84
var coderBoolNoZero = pointerCoderFuncs{
86
marshal: appendBoolNoZero,
87
unmarshal: consumeBool,
88
merge: mergeBoolNoZero,
93
func sizeBoolPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
95
return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
100
func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
102
b = protowire.AppendVarint(b, f.wiretag)
103
b = protowire.AppendVarint(b, protowire.EncodeBool(v))
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
114
if len(b) >= 1 && b[0] < 0x80 {
117
} else if len(b) >= 2 && b[1] < 128 {
118
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
121
v, n = protowire.ConsumeVarint(b)
124
return out, errDecode
130
**vp = protowire.DecodeBool(v)
135
var coderBoolPtr = pointerCoderFuncs{
137
marshal: appendBoolPtr,
138
unmarshal: consumeBoolPtr,
143
func sizeBoolSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
145
for _, v := range s {
146
size += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
152
func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
154
for _, v := range s {
155
b = protowire.AppendVarint(b, f.wiretag)
156
b = protowire.AppendVarint(b, protowire.EncodeBool(v))
162
func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
164
if wtyp == protowire.BytesType {
165
b, n := protowire.ConsumeBytes(b)
167
return out, errDecode
170
for _, v := range b {
176
p.growBoolSlice(count)
182
if len(b) >= 1 && b[0] < 0x80 {
185
} else if len(b) >= 2 && b[1] < 128 {
186
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
189
v, n = protowire.ConsumeVarint(b)
192
return out, errDecode
194
s = append(s, protowire.DecodeBool(v))
201
if wtyp != protowire.VarintType {
202
return out, errUnknown
206
if len(b) >= 1 && b[0] < 0x80 {
209
} else if len(b) >= 2 && b[1] < 128 {
210
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
213
v, n = protowire.ConsumeVarint(b)
216
return out, errDecode
218
*sp = append(*sp, protowire.DecodeBool(v))
223
var coderBoolSlice = pointerCoderFuncs{
225
marshal: appendBoolSlice,
226
unmarshal: consumeBoolSlice,
227
merge: mergeBoolSlice,
231
func sizeBoolPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
237
for _, v := range s {
238
n += protowire.SizeVarint(protowire.EncodeBool(v))
240
return f.tagsize + protowire.SizeBytes(n)
244
func appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
249
b = protowire.AppendVarint(b, f.wiretag)
251
for _, v := range s {
252
n += protowire.SizeVarint(protowire.EncodeBool(v))
254
b = protowire.AppendVarint(b, uint64(n))
255
for _, v := range s {
256
b = protowire.AppendVarint(b, protowire.EncodeBool(v))
261
var coderBoolPackedSlice = pointerCoderFuncs{
262
size: sizeBoolPackedSlice,
263
marshal: appendBoolPackedSlice,
264
unmarshal: consumeBoolSlice,
265
merge: mergeBoolSlice,
269
func sizeBoolValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
270
return tagsize + protowire.SizeVarint(protowire.EncodeBool(v.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()))
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
287
if len(b) >= 1 && b[0] < 0x80 {
290
} else if len(b) >= 2 && b[1] < 128 {
291
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
294
v, n = protowire.ConsumeVarint(b)
297
return protoreflect.Value{}, out, errDecode
300
return protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil
303
var coderBoolValue = valueCoderFuncs{
305
marshal: appendBoolValue,
306
unmarshal: consumeBoolValue,
307
merge: mergeScalarValue,
311
func sizeBoolSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
313
for i, llen := 0, list.Len(); i < llen; i++ {
315
size += tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
321
func appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
323
for i, llen := 0, list.Len(); i < llen; i++ {
325
b = protowire.AppendVarint(b, wiretag)
326
b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
332
func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
334
if wtyp == protowire.BytesType {
335
b, n := protowire.ConsumeBytes(b)
337
return protoreflect.Value{}, out, errDecode
342
if len(b) >= 1 && b[0] < 0x80 {
345
} else if len(b) >= 2 && b[1] < 128 {
346
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
349
v, n = protowire.ConsumeVarint(b)
352
return protoreflect.Value{}, out, errDecode
354
list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
358
return listv, out, nil
360
if wtyp != protowire.VarintType {
361
return protoreflect.Value{}, out, errUnknown
365
if len(b) >= 1 && b[0] < 0x80 {
368
} else if len(b) >= 2 && b[1] < 128 {
369
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
372
v, n = protowire.ConsumeVarint(b)
375
return protoreflect.Value{}, out, errDecode
377
list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
379
return listv, out, nil
382
var coderBoolSliceValue = valueCoderFuncs{
383
size: sizeBoolSliceValue,
384
marshal: appendBoolSliceValue,
385
unmarshal: consumeBoolSliceValue,
386
merge: mergeListValue,
390
func sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
397
for i, llen := 0, llen; i < llen; i++ {
399
n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
401
return tagsize + protowire.SizeBytes(n)
405
func appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
411
b = protowire.AppendVarint(b, wiretag)
413
for i := 0; i < llen; i++ {
415
n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
417
b = protowire.AppendVarint(b, uint64(n))
418
for i := 0; i < llen; i++ {
420
b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
425
var coderBoolPackedSliceValue = valueCoderFuncs{
426
size: sizeBoolPackedSliceValue,
427
marshal: appendBoolPackedSliceValue,
428
unmarshal: consumeBoolSliceValue,
429
merge: mergeListValue,
433
func sizeEnumValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
434
return tagsize + protowire.SizeVarint(uint64(v.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()))
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
451
if len(b) >= 1 && b[0] < 0x80 {
454
} else if len(b) >= 2 && b[1] < 128 {
455
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
458
v, n = protowire.ConsumeVarint(b)
461
return protoreflect.Value{}, out, errDecode
464
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil
467
var coderEnumValue = valueCoderFuncs{
469
marshal: appendEnumValue,
470
unmarshal: consumeEnumValue,
471
merge: mergeScalarValue,
475
func sizeEnumSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
477
for i, llen := 0, list.Len(); i < llen; i++ {
479
size += tagsize + protowire.SizeVarint(uint64(v.Enum()))
485
func appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
487
for i, llen := 0, list.Len(); i < llen; i++ {
489
b = protowire.AppendVarint(b, wiretag)
490
b = protowire.AppendVarint(b, uint64(v.Enum()))
496
func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
498
if wtyp == protowire.BytesType {
499
b, n := protowire.ConsumeBytes(b)
501
return protoreflect.Value{}, out, errDecode
506
if len(b) >= 1 && b[0] < 0x80 {
509
} else if len(b) >= 2 && b[1] < 128 {
510
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
513
v, n = protowire.ConsumeVarint(b)
516
return protoreflect.Value{}, out, errDecode
518
list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
522
return listv, out, nil
524
if wtyp != protowire.VarintType {
525
return protoreflect.Value{}, out, errUnknown
529
if len(b) >= 1 && b[0] < 0x80 {
532
} else if len(b) >= 2 && b[1] < 128 {
533
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
536
v, n = protowire.ConsumeVarint(b)
539
return protoreflect.Value{}, out, errDecode
541
list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
543
return listv, out, nil
546
var coderEnumSliceValue = valueCoderFuncs{
547
size: sizeEnumSliceValue,
548
marshal: appendEnumSliceValue,
549
unmarshal: consumeEnumSliceValue,
550
merge: mergeListValue,
554
func sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
561
for i, llen := 0, llen; i < llen; i++ {
563
n += protowire.SizeVarint(uint64(v.Enum()))
565
return tagsize + protowire.SizeBytes(n)
569
func appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
575
b = protowire.AppendVarint(b, wiretag)
577
for i := 0; i < llen; i++ {
579
n += protowire.SizeVarint(uint64(v.Enum()))
581
b = protowire.AppendVarint(b, uint64(n))
582
for i := 0; i < llen; i++ {
584
b = protowire.AppendVarint(b, uint64(v.Enum()))
589
var coderEnumPackedSliceValue = valueCoderFuncs{
590
size: sizeEnumPackedSliceValue,
591
marshal: appendEnumPackedSliceValue,
592
unmarshal: consumeEnumSliceValue,
593
merge: mergeListValue,
597
func sizeInt32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
599
return f.tagsize + protowire.SizeVarint(uint64(v))
603
func appendInt32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
605
b = protowire.AppendVarint(b, f.wiretag)
606
b = protowire.AppendVarint(b, uint64(v))
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
617
if len(b) >= 1 && b[0] < 0x80 {
620
} else if len(b) >= 2 && b[1] < 128 {
621
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
624
v, n = protowire.ConsumeVarint(b)
627
return out, errDecode
629
*p.Int32() = int32(v)
634
var coderInt32 = pointerCoderFuncs{
636
marshal: appendInt32,
637
unmarshal: consumeInt32,
643
func sizeInt32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
648
return f.tagsize + protowire.SizeVarint(uint64(v))
653
func appendInt32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
658
b = protowire.AppendVarint(b, f.wiretag)
659
b = protowire.AppendVarint(b, uint64(v))
663
var coderInt32NoZero = pointerCoderFuncs{
664
size: sizeInt32NoZero,
665
marshal: appendInt32NoZero,
666
unmarshal: consumeInt32,
667
merge: mergeInt32NoZero,
672
func sizeInt32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
674
return f.tagsize + protowire.SizeVarint(uint64(v))
679
func appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
681
b = protowire.AppendVarint(b, f.wiretag)
682
b = protowire.AppendVarint(b, uint64(v))
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
693
if len(b) >= 1 && b[0] < 0x80 {
696
} else if len(b) >= 2 && b[1] < 128 {
697
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
700
v, n = protowire.ConsumeVarint(b)
703
return out, errDecode
714
var coderInt32Ptr = pointerCoderFuncs{
716
marshal: appendInt32Ptr,
717
unmarshal: consumeInt32Ptr,
718
merge: mergeInt32Ptr,
722
func sizeInt32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
724
for _, v := range s {
725
size += f.tagsize + protowire.SizeVarint(uint64(v))
731
func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
733
for _, v := range s {
734
b = protowire.AppendVarint(b, f.wiretag)
735
b = protowire.AppendVarint(b, uint64(v))
741
func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
743
if wtyp == protowire.BytesType {
744
b, n := protowire.ConsumeBytes(b)
746
return out, errDecode
749
for _, v := range b {
755
p.growInt32Slice(count)
761
if len(b) >= 1 && b[0] < 0x80 {
764
} else if len(b) >= 2 && b[1] < 128 {
765
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
768
v, n = protowire.ConsumeVarint(b)
771
return out, errDecode
773
s = append(s, int32(v))
780
if wtyp != protowire.VarintType {
781
return out, errUnknown
785
if len(b) >= 1 && b[0] < 0x80 {
788
} else if len(b) >= 2 && b[1] < 128 {
789
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
792
v, n = protowire.ConsumeVarint(b)
795
return out, errDecode
797
*sp = append(*sp, int32(v))
802
var coderInt32Slice = pointerCoderFuncs{
803
size: sizeInt32Slice,
804
marshal: appendInt32Slice,
805
unmarshal: consumeInt32Slice,
806
merge: mergeInt32Slice,
810
func sizeInt32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
816
for _, v := range s {
817
n += protowire.SizeVarint(uint64(v))
819
return f.tagsize + protowire.SizeBytes(n)
823
func appendInt32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
828
b = protowire.AppendVarint(b, f.wiretag)
830
for _, v := range s {
831
n += protowire.SizeVarint(uint64(v))
833
b = protowire.AppendVarint(b, uint64(n))
834
for _, v := range s {
835
b = protowire.AppendVarint(b, uint64(v))
840
var coderInt32PackedSlice = pointerCoderFuncs{
841
size: sizeInt32PackedSlice,
842
marshal: appendInt32PackedSlice,
843
unmarshal: consumeInt32Slice,
844
merge: mergeInt32Slice,
848
func sizeInt32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
849
return tagsize + protowire.SizeVarint(uint64(int32(v.Int())))
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())))
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
866
if len(b) >= 1 && b[0] < 0x80 {
869
} else if len(b) >= 2 && b[1] < 128 {
870
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
873
v, n = protowire.ConsumeVarint(b)
876
return protoreflect.Value{}, out, errDecode
879
return protoreflect.ValueOfInt32(int32(v)), out, nil
882
var coderInt32Value = valueCoderFuncs{
883
size: sizeInt32Value,
884
marshal: appendInt32Value,
885
unmarshal: consumeInt32Value,
886
merge: mergeScalarValue,
890
func sizeInt32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
892
for i, llen := 0, list.Len(); i < llen; i++ {
894
size += tagsize + protowire.SizeVarint(uint64(int32(v.Int())))
900
func appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
902
for i, llen := 0, list.Len(); i < llen; i++ {
904
b = protowire.AppendVarint(b, wiretag)
905
b = protowire.AppendVarint(b, uint64(int32(v.Int())))
911
func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
913
if wtyp == protowire.BytesType {
914
b, n := protowire.ConsumeBytes(b)
916
return protoreflect.Value{}, out, errDecode
921
if len(b) >= 1 && b[0] < 0x80 {
924
} else if len(b) >= 2 && b[1] < 128 {
925
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
928
v, n = protowire.ConsumeVarint(b)
931
return protoreflect.Value{}, out, errDecode
933
list.Append(protoreflect.ValueOfInt32(int32(v)))
937
return listv, out, nil
939
if wtyp != protowire.VarintType {
940
return protoreflect.Value{}, out, errUnknown
944
if len(b) >= 1 && b[0] < 0x80 {
947
} else if len(b) >= 2 && b[1] < 128 {
948
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
951
v, n = protowire.ConsumeVarint(b)
954
return protoreflect.Value{}, out, errDecode
956
list.Append(protoreflect.ValueOfInt32(int32(v)))
958
return listv, out, nil
961
var coderInt32SliceValue = valueCoderFuncs{
962
size: sizeInt32SliceValue,
963
marshal: appendInt32SliceValue,
964
unmarshal: consumeInt32SliceValue,
965
merge: mergeListValue,
969
func sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
976
for i, llen := 0, llen; i < llen; i++ {
978
n += protowire.SizeVarint(uint64(int32(v.Int())))
980
return tagsize + protowire.SizeBytes(n)
984
func appendInt32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
990
b = protowire.AppendVarint(b, wiretag)
992
for i := 0; i < llen; i++ {
994
n += protowire.SizeVarint(uint64(int32(v.Int())))
996
b = protowire.AppendVarint(b, uint64(n))
997
for i := 0; i < llen; i++ {
999
b = protowire.AppendVarint(b, uint64(int32(v.Int())))
1004
var coderInt32PackedSliceValue = valueCoderFuncs{
1005
size: sizeInt32PackedSliceValue,
1006
marshal: appendInt32PackedSliceValue,
1007
unmarshal: consumeInt32SliceValue,
1008
merge: mergeListValue,
1012
func sizeSint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1014
return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1018
func appendSint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1020
b = protowire.AppendVarint(b, f.wiretag)
1021
b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
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
1032
if len(b) >= 1 && b[0] < 0x80 {
1035
} else if len(b) >= 2 && b[1] < 128 {
1036
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1039
v, n = protowire.ConsumeVarint(b)
1042
return out, errDecode
1044
*p.Int32() = int32(protowire.DecodeZigZag(v & math.MaxUint32))
1049
var coderSint32 = pointerCoderFuncs{
1051
marshal: appendSint32,
1052
unmarshal: consumeSint32,
1058
func sizeSint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1063
return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1068
func appendSint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1073
b = protowire.AppendVarint(b, f.wiretag)
1074
b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
1078
var coderSint32NoZero = pointerCoderFuncs{
1079
size: sizeSint32NoZero,
1080
marshal: appendSint32NoZero,
1081
unmarshal: consumeSint32,
1082
merge: mergeInt32NoZero,
1087
func sizeSint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1089
return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1094
func appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1096
b = protowire.AppendVarint(b, f.wiretag)
1097
b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
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
1108
if len(b) >= 1 && b[0] < 0x80 {
1111
} else if len(b) >= 2 && b[1] < 128 {
1112
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1115
v, n = protowire.ConsumeVarint(b)
1118
return out, errDecode
1124
**vp = int32(protowire.DecodeZigZag(v & math.MaxUint32))
1129
var coderSint32Ptr = pointerCoderFuncs{
1130
size: sizeSint32Ptr,
1131
marshal: appendSint32Ptr,
1132
unmarshal: consumeSint32Ptr,
1133
merge: mergeInt32Ptr,
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)))
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)))
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)
1161
return out, errDecode
1164
for _, v := range b {
1170
p.growInt32Slice(count)
1176
if len(b) >= 1 && b[0] < 0x80 {
1179
} else if len(b) >= 2 && b[1] < 128 {
1180
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1183
v, n = protowire.ConsumeVarint(b)
1186
return out, errDecode
1188
s = append(s, int32(protowire.DecodeZigZag(v&math.MaxUint32)))
1195
if wtyp != protowire.VarintType {
1196
return out, errUnknown
1200
if len(b) >= 1 && b[0] < 0x80 {
1203
} else if len(b) >= 2 && b[1] < 128 {
1204
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1207
v, n = protowire.ConsumeVarint(b)
1210
return out, errDecode
1212
*sp = append(*sp, int32(protowire.DecodeZigZag(v&math.MaxUint32)))
1217
var coderSint32Slice = pointerCoderFuncs{
1218
size: sizeSint32Slice,
1219
marshal: appendSint32Slice,
1220
unmarshal: consumeSint32Slice,
1221
merge: mergeInt32Slice,
1225
func sizeSint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1226
s := *p.Int32Slice()
1231
for _, v := range s {
1232
n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1234
return f.tagsize + protowire.SizeBytes(n)
1238
func appendSint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1239
s := *p.Int32Slice()
1243
b = protowire.AppendVarint(b, f.wiretag)
1245
for _, v := range s {
1246
n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
1248
b = protowire.AppendVarint(b, uint64(n))
1249
for _, v := range s {
1250
b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
1255
var coderSint32PackedSlice = pointerCoderFuncs{
1256
size: sizeSint32PackedSlice,
1257
marshal: appendSint32PackedSlice,
1258
unmarshal: consumeSint32Slice,
1259
merge: mergeInt32Slice,
1263
func sizeSint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
1264
return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
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()))))
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
1281
if len(b) >= 1 && b[0] < 0x80 {
1284
} else if len(b) >= 2 && b[1] < 128 {
1285
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1288
v, n = protowire.ConsumeVarint(b)
1291
return protoreflect.Value{}, out, errDecode
1294
return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), out, nil
1297
var coderSint32Value = valueCoderFuncs{
1298
size: sizeSint32Value,
1299
marshal: appendSint32Value,
1300
unmarshal: consumeSint32Value,
1301
merge: mergeScalarValue,
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++ {
1309
size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
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++ {
1319
b = protowire.AppendVarint(b, wiretag)
1320
b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
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)
1331
return protoreflect.Value{}, out, errDecode
1336
if len(b) >= 1 && b[0] < 0x80 {
1339
} else if len(b) >= 2 && b[1] < 128 {
1340
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1343
v, n = protowire.ConsumeVarint(b)
1346
return protoreflect.Value{}, out, errDecode
1348
list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
1352
return listv, out, nil
1354
if wtyp != protowire.VarintType {
1355
return protoreflect.Value{}, out, errUnknown
1359
if len(b) >= 1 && b[0] < 0x80 {
1362
} else if len(b) >= 2 && b[1] < 128 {
1363
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1366
v, n = protowire.ConsumeVarint(b)
1369
return protoreflect.Value{}, out, errDecode
1371
list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
1373
return listv, out, nil
1376
var coderSint32SliceValue = valueCoderFuncs{
1377
size: sizeSint32SliceValue,
1378
marshal: appendSint32SliceValue,
1379
unmarshal: consumeSint32SliceValue,
1380
merge: mergeListValue,
1384
func sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
1385
list := listv.List()
1391
for i, llen := 0, llen; i < llen; i++ {
1393
n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
1395
return tagsize + protowire.SizeBytes(n)
1399
func appendSint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
1400
list := listv.List()
1405
b = protowire.AppendVarint(b, wiretag)
1407
for i := 0; i < llen; i++ {
1409
n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
1411
b = protowire.AppendVarint(b, uint64(n))
1412
for i := 0; i < llen; i++ {
1414
b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
1419
var coderSint32PackedSliceValue = valueCoderFuncs{
1420
size: sizeSint32PackedSliceValue,
1421
marshal: appendSint32PackedSliceValue,
1422
unmarshal: consumeSint32SliceValue,
1423
merge: mergeListValue,
1427
func sizeUint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1429
return f.tagsize + protowire.SizeVarint(uint64(v))
1433
func appendUint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1435
b = protowire.AppendVarint(b, f.wiretag)
1436
b = protowire.AppendVarint(b, uint64(v))
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
1447
if len(b) >= 1 && b[0] < 0x80 {
1450
} else if len(b) >= 2 && b[1] < 128 {
1451
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1454
v, n = protowire.ConsumeVarint(b)
1457
return out, errDecode
1459
*p.Uint32() = uint32(v)
1464
var coderUint32 = pointerCoderFuncs{
1466
marshal: appendUint32,
1467
unmarshal: consumeUint32,
1473
func sizeUint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1478
return f.tagsize + protowire.SizeVarint(uint64(v))
1483
func appendUint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1488
b = protowire.AppendVarint(b, f.wiretag)
1489
b = protowire.AppendVarint(b, uint64(v))
1493
var coderUint32NoZero = pointerCoderFuncs{
1494
size: sizeUint32NoZero,
1495
marshal: appendUint32NoZero,
1496
unmarshal: consumeUint32,
1497
merge: mergeUint32NoZero,
1502
func sizeUint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1503
v := **p.Uint32Ptr()
1504
return f.tagsize + protowire.SizeVarint(uint64(v))
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))
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
1523
if len(b) >= 1 && b[0] < 0x80 {
1526
} else if len(b) >= 2 && b[1] < 128 {
1527
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1530
v, n = protowire.ConsumeVarint(b)
1533
return out, errDecode
1544
var coderUint32Ptr = pointerCoderFuncs{
1545
size: sizeUint32Ptr,
1546
marshal: appendUint32Ptr,
1547
unmarshal: consumeUint32Ptr,
1548
merge: mergeUint32Ptr,
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))
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))
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)
1576
return out, errDecode
1579
for _, v := range b {
1585
p.growUint32Slice(count)
1591
if len(b) >= 1 && b[0] < 0x80 {
1594
} else if len(b) >= 2 && b[1] < 128 {
1595
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1598
v, n = protowire.ConsumeVarint(b)
1601
return out, errDecode
1603
s = append(s, uint32(v))
1610
if wtyp != protowire.VarintType {
1611
return out, errUnknown
1615
if len(b) >= 1 && b[0] < 0x80 {
1618
} else if len(b) >= 2 && b[1] < 128 {
1619
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1622
v, n = protowire.ConsumeVarint(b)
1625
return out, errDecode
1627
*sp = append(*sp, uint32(v))
1632
var coderUint32Slice = pointerCoderFuncs{
1633
size: sizeUint32Slice,
1634
marshal: appendUint32Slice,
1635
unmarshal: consumeUint32Slice,
1636
merge: mergeUint32Slice,
1640
func sizeUint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1641
s := *p.Uint32Slice()
1646
for _, v := range s {
1647
n += protowire.SizeVarint(uint64(v))
1649
return f.tagsize + protowire.SizeBytes(n)
1653
func appendUint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1654
s := *p.Uint32Slice()
1658
b = protowire.AppendVarint(b, f.wiretag)
1660
for _, v := range s {
1661
n += protowire.SizeVarint(uint64(v))
1663
b = protowire.AppendVarint(b, uint64(n))
1664
for _, v := range s {
1665
b = protowire.AppendVarint(b, uint64(v))
1670
var coderUint32PackedSlice = pointerCoderFuncs{
1671
size: sizeUint32PackedSlice,
1672
marshal: appendUint32PackedSlice,
1673
unmarshal: consumeUint32Slice,
1674
merge: mergeUint32Slice,
1678
func sizeUint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
1679
return tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))
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())))
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
1696
if len(b) >= 1 && b[0] < 0x80 {
1699
} else if len(b) >= 2 && b[1] < 128 {
1700
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1703
v, n = protowire.ConsumeVarint(b)
1706
return protoreflect.Value{}, out, errDecode
1709
return protoreflect.ValueOfUint32(uint32(v)), out, nil
1712
var coderUint32Value = valueCoderFuncs{
1713
size: sizeUint32Value,
1714
marshal: appendUint32Value,
1715
unmarshal: consumeUint32Value,
1716
merge: mergeScalarValue,
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++ {
1724
size += tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))
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++ {
1734
b = protowire.AppendVarint(b, wiretag)
1735
b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
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)
1746
return protoreflect.Value{}, out, errDecode
1751
if len(b) >= 1 && b[0] < 0x80 {
1754
} else if len(b) >= 2 && b[1] < 128 {
1755
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1758
v, n = protowire.ConsumeVarint(b)
1761
return protoreflect.Value{}, out, errDecode
1763
list.Append(protoreflect.ValueOfUint32(uint32(v)))
1767
return listv, out, nil
1769
if wtyp != protowire.VarintType {
1770
return protoreflect.Value{}, out, errUnknown
1774
if len(b) >= 1 && b[0] < 0x80 {
1777
} else if len(b) >= 2 && b[1] < 128 {
1778
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1781
v, n = protowire.ConsumeVarint(b)
1784
return protoreflect.Value{}, out, errDecode
1786
list.Append(protoreflect.ValueOfUint32(uint32(v)))
1788
return listv, out, nil
1791
var coderUint32SliceValue = valueCoderFuncs{
1792
size: sizeUint32SliceValue,
1793
marshal: appendUint32SliceValue,
1794
unmarshal: consumeUint32SliceValue,
1795
merge: mergeListValue,
1799
func sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
1800
list := listv.List()
1806
for i, llen := 0, llen; i < llen; i++ {
1808
n += protowire.SizeVarint(uint64(uint32(v.Uint())))
1810
return tagsize + protowire.SizeBytes(n)
1814
func appendUint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
1815
list := listv.List()
1820
b = protowire.AppendVarint(b, wiretag)
1822
for i := 0; i < llen; i++ {
1824
n += protowire.SizeVarint(uint64(uint32(v.Uint())))
1826
b = protowire.AppendVarint(b, uint64(n))
1827
for i := 0; i < llen; i++ {
1829
b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
1834
var coderUint32PackedSliceValue = valueCoderFuncs{
1835
size: sizeUint32PackedSliceValue,
1836
marshal: appendUint32PackedSliceValue,
1837
unmarshal: consumeUint32SliceValue,
1838
merge: mergeListValue,
1842
func sizeInt64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1844
return f.tagsize + protowire.SizeVarint(uint64(v))
1848
func appendInt64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1850
b = protowire.AppendVarint(b, f.wiretag)
1851
b = protowire.AppendVarint(b, uint64(v))
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
1862
if len(b) >= 1 && b[0] < 0x80 {
1865
} else if len(b) >= 2 && b[1] < 128 {
1866
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1869
v, n = protowire.ConsumeVarint(b)
1872
return out, errDecode
1874
*p.Int64() = int64(v)
1879
var coderInt64 = pointerCoderFuncs{
1881
marshal: appendInt64,
1882
unmarshal: consumeInt64,
1888
func sizeInt64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1893
return f.tagsize + protowire.SizeVarint(uint64(v))
1898
func appendInt64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1903
b = protowire.AppendVarint(b, f.wiretag)
1904
b = protowire.AppendVarint(b, uint64(v))
1908
var coderInt64NoZero = pointerCoderFuncs{
1909
size: sizeInt64NoZero,
1910
marshal: appendInt64NoZero,
1911
unmarshal: consumeInt64,
1912
merge: mergeInt64NoZero,
1917
func sizeInt64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
1919
return f.tagsize + protowire.SizeVarint(uint64(v))
1924
func appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
1926
b = protowire.AppendVarint(b, f.wiretag)
1927
b = protowire.AppendVarint(b, uint64(v))
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
1938
if len(b) >= 1 && b[0] < 0x80 {
1941
} else if len(b) >= 2 && b[1] < 128 {
1942
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
1945
v, n = protowire.ConsumeVarint(b)
1948
return out, errDecode
1959
var coderInt64Ptr = pointerCoderFuncs{
1961
marshal: appendInt64Ptr,
1962
unmarshal: consumeInt64Ptr,
1963
merge: mergeInt64Ptr,
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))
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))
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)
1991
return out, errDecode
1994
for _, v := range b {
2000
p.growInt64Slice(count)
2006
if len(b) >= 1 && b[0] < 0x80 {
2009
} else if len(b) >= 2 && b[1] < 128 {
2010
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2013
v, n = protowire.ConsumeVarint(b)
2016
return out, errDecode
2018
s = append(s, int64(v))
2025
if wtyp != protowire.VarintType {
2026
return out, errUnknown
2030
if len(b) >= 1 && b[0] < 0x80 {
2033
} else if len(b) >= 2 && b[1] < 128 {
2034
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2037
v, n = protowire.ConsumeVarint(b)
2040
return out, errDecode
2042
*sp = append(*sp, int64(v))
2047
var coderInt64Slice = pointerCoderFuncs{
2048
size: sizeInt64Slice,
2049
marshal: appendInt64Slice,
2050
unmarshal: consumeInt64Slice,
2051
merge: mergeInt64Slice,
2055
func sizeInt64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2056
s := *p.Int64Slice()
2061
for _, v := range s {
2062
n += protowire.SizeVarint(uint64(v))
2064
return f.tagsize + protowire.SizeBytes(n)
2068
func appendInt64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2069
s := *p.Int64Slice()
2073
b = protowire.AppendVarint(b, f.wiretag)
2075
for _, v := range s {
2076
n += protowire.SizeVarint(uint64(v))
2078
b = protowire.AppendVarint(b, uint64(n))
2079
for _, v := range s {
2080
b = protowire.AppendVarint(b, uint64(v))
2085
var coderInt64PackedSlice = pointerCoderFuncs{
2086
size: sizeInt64PackedSlice,
2087
marshal: appendInt64PackedSlice,
2088
unmarshal: consumeInt64Slice,
2089
merge: mergeInt64Slice,
2093
func sizeInt64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
2094
return tagsize + protowire.SizeVarint(uint64(v.Int()))
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()))
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
2111
if len(b) >= 1 && b[0] < 0x80 {
2114
} else if len(b) >= 2 && b[1] < 128 {
2115
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2118
v, n = protowire.ConsumeVarint(b)
2121
return protoreflect.Value{}, out, errDecode
2124
return protoreflect.ValueOfInt64(int64(v)), out, nil
2127
var coderInt64Value = valueCoderFuncs{
2128
size: sizeInt64Value,
2129
marshal: appendInt64Value,
2130
unmarshal: consumeInt64Value,
2131
merge: mergeScalarValue,
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++ {
2139
size += tagsize + protowire.SizeVarint(uint64(v.Int()))
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++ {
2149
b = protowire.AppendVarint(b, wiretag)
2150
b = protowire.AppendVarint(b, uint64(v.Int()))
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)
2161
return protoreflect.Value{}, out, errDecode
2166
if len(b) >= 1 && b[0] < 0x80 {
2169
} else if len(b) >= 2 && b[1] < 128 {
2170
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2173
v, n = protowire.ConsumeVarint(b)
2176
return protoreflect.Value{}, out, errDecode
2178
list.Append(protoreflect.ValueOfInt64(int64(v)))
2182
return listv, out, nil
2184
if wtyp != protowire.VarintType {
2185
return protoreflect.Value{}, out, errUnknown
2189
if len(b) >= 1 && b[0] < 0x80 {
2192
} else if len(b) >= 2 && b[1] < 128 {
2193
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2196
v, n = protowire.ConsumeVarint(b)
2199
return protoreflect.Value{}, out, errDecode
2201
list.Append(protoreflect.ValueOfInt64(int64(v)))
2203
return listv, out, nil
2206
var coderInt64SliceValue = valueCoderFuncs{
2207
size: sizeInt64SliceValue,
2208
marshal: appendInt64SliceValue,
2209
unmarshal: consumeInt64SliceValue,
2210
merge: mergeListValue,
2214
func sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
2215
list := listv.List()
2221
for i, llen := 0, llen; i < llen; i++ {
2223
n += protowire.SizeVarint(uint64(v.Int()))
2225
return tagsize + protowire.SizeBytes(n)
2229
func appendInt64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2230
list := listv.List()
2235
b = protowire.AppendVarint(b, wiretag)
2237
for i := 0; i < llen; i++ {
2239
n += protowire.SizeVarint(uint64(v.Int()))
2241
b = protowire.AppendVarint(b, uint64(n))
2242
for i := 0; i < llen; i++ {
2244
b = protowire.AppendVarint(b, uint64(v.Int()))
2249
var coderInt64PackedSliceValue = valueCoderFuncs{
2250
size: sizeInt64PackedSliceValue,
2251
marshal: appendInt64PackedSliceValue,
2252
unmarshal: consumeInt64SliceValue,
2253
merge: mergeListValue,
2257
func sizeSint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2259
return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
2263
func appendSint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2265
b = protowire.AppendVarint(b, f.wiretag)
2266
b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
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
2277
if len(b) >= 1 && b[0] < 0x80 {
2280
} else if len(b) >= 2 && b[1] < 128 {
2281
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2284
v, n = protowire.ConsumeVarint(b)
2287
return out, errDecode
2289
*p.Int64() = protowire.DecodeZigZag(v)
2294
var coderSint64 = pointerCoderFuncs{
2296
marshal: appendSint64,
2297
unmarshal: consumeSint64,
2303
func sizeSint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2308
return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
2313
func appendSint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2318
b = protowire.AppendVarint(b, f.wiretag)
2319
b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
2323
var coderSint64NoZero = pointerCoderFuncs{
2324
size: sizeSint64NoZero,
2325
marshal: appendSint64NoZero,
2326
unmarshal: consumeSint64,
2327
merge: mergeInt64NoZero,
2332
func sizeSint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2334
return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
2339
func appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2341
b = protowire.AppendVarint(b, f.wiretag)
2342
b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
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
2353
if len(b) >= 1 && b[0] < 0x80 {
2356
} else if len(b) >= 2 && b[1] < 128 {
2357
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2360
v, n = protowire.ConsumeVarint(b)
2363
return out, errDecode
2369
**vp = protowire.DecodeZigZag(v)
2374
var coderSint64Ptr = pointerCoderFuncs{
2375
size: sizeSint64Ptr,
2376
marshal: appendSint64Ptr,
2377
unmarshal: consumeSint64Ptr,
2378
merge: mergeInt64Ptr,
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))
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))
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)
2406
return out, errDecode
2409
for _, v := range b {
2415
p.growInt64Slice(count)
2421
if len(b) >= 1 && b[0] < 0x80 {
2424
} else if len(b) >= 2 && b[1] < 128 {
2425
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2428
v, n = protowire.ConsumeVarint(b)
2431
return out, errDecode
2433
s = append(s, protowire.DecodeZigZag(v))
2440
if wtyp != protowire.VarintType {
2441
return out, errUnknown
2445
if len(b) >= 1 && b[0] < 0x80 {
2448
} else if len(b) >= 2 && b[1] < 128 {
2449
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2452
v, n = protowire.ConsumeVarint(b)
2455
return out, errDecode
2457
*sp = append(*sp, protowire.DecodeZigZag(v))
2462
var coderSint64Slice = pointerCoderFuncs{
2463
size: sizeSint64Slice,
2464
marshal: appendSint64Slice,
2465
unmarshal: consumeSint64Slice,
2466
merge: mergeInt64Slice,
2470
func sizeSint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2471
s := *p.Int64Slice()
2476
for _, v := range s {
2477
n += protowire.SizeVarint(protowire.EncodeZigZag(v))
2479
return f.tagsize + protowire.SizeBytes(n)
2483
func appendSint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2484
s := *p.Int64Slice()
2488
b = protowire.AppendVarint(b, f.wiretag)
2490
for _, v := range s {
2491
n += protowire.SizeVarint(protowire.EncodeZigZag(v))
2493
b = protowire.AppendVarint(b, uint64(n))
2494
for _, v := range s {
2495
b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
2500
var coderSint64PackedSlice = pointerCoderFuncs{
2501
size: sizeSint64PackedSlice,
2502
marshal: appendSint64PackedSlice,
2503
unmarshal: consumeSint64Slice,
2504
merge: mergeInt64Slice,
2508
func sizeSint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
2509
return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
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()))
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
2526
if len(b) >= 1 && b[0] < 0x80 {
2529
} else if len(b) >= 2 && b[1] < 128 {
2530
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2533
v, n = protowire.ConsumeVarint(b)
2536
return protoreflect.Value{}, out, errDecode
2539
return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), out, nil
2542
var coderSint64Value = valueCoderFuncs{
2543
size: sizeSint64Value,
2544
marshal: appendSint64Value,
2545
unmarshal: consumeSint64Value,
2546
merge: mergeScalarValue,
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++ {
2554
size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
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++ {
2564
b = protowire.AppendVarint(b, wiretag)
2565
b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
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)
2576
return protoreflect.Value{}, out, errDecode
2581
if len(b) >= 1 && b[0] < 0x80 {
2584
} else if len(b) >= 2 && b[1] < 128 {
2585
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2588
v, n = protowire.ConsumeVarint(b)
2591
return protoreflect.Value{}, out, errDecode
2593
list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
2597
return listv, out, nil
2599
if wtyp != protowire.VarintType {
2600
return protoreflect.Value{}, out, errUnknown
2604
if len(b) >= 1 && b[0] < 0x80 {
2607
} else if len(b) >= 2 && b[1] < 128 {
2608
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2611
v, n = protowire.ConsumeVarint(b)
2614
return protoreflect.Value{}, out, errDecode
2616
list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
2618
return listv, out, nil
2621
var coderSint64SliceValue = valueCoderFuncs{
2622
size: sizeSint64SliceValue,
2623
marshal: appendSint64SliceValue,
2624
unmarshal: consumeSint64SliceValue,
2625
merge: mergeListValue,
2629
func sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
2630
list := listv.List()
2636
for i, llen := 0, llen; i < llen; i++ {
2638
n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
2640
return tagsize + protowire.SizeBytes(n)
2644
func appendSint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
2645
list := listv.List()
2650
b = protowire.AppendVarint(b, wiretag)
2652
for i := 0; i < llen; i++ {
2654
n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
2656
b = protowire.AppendVarint(b, uint64(n))
2657
for i := 0; i < llen; i++ {
2659
b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
2664
var coderSint64PackedSliceValue = valueCoderFuncs{
2665
size: sizeSint64PackedSliceValue,
2666
marshal: appendSint64PackedSliceValue,
2667
unmarshal: consumeSint64SliceValue,
2668
merge: mergeListValue,
2672
func sizeUint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2674
return f.tagsize + protowire.SizeVarint(v)
2678
func appendUint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2680
b = protowire.AppendVarint(b, f.wiretag)
2681
b = protowire.AppendVarint(b, v)
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
2692
if len(b) >= 1 && b[0] < 0x80 {
2695
} else if len(b) >= 2 && b[1] < 128 {
2696
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2699
v, n = protowire.ConsumeVarint(b)
2702
return out, errDecode
2709
var coderUint64 = pointerCoderFuncs{
2711
marshal: appendUint64,
2712
unmarshal: consumeUint64,
2718
func sizeUint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2723
return f.tagsize + protowire.SizeVarint(v)
2728
func appendUint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2733
b = protowire.AppendVarint(b, f.wiretag)
2734
b = protowire.AppendVarint(b, v)
2738
var coderUint64NoZero = pointerCoderFuncs{
2739
size: sizeUint64NoZero,
2740
marshal: appendUint64NoZero,
2741
unmarshal: consumeUint64,
2742
merge: mergeUint64NoZero,
2747
func sizeUint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2748
v := **p.Uint64Ptr()
2749
return f.tagsize + protowire.SizeVarint(v)
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)
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
2768
if len(b) >= 1 && b[0] < 0x80 {
2771
} else if len(b) >= 2 && b[1] < 128 {
2772
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2775
v, n = protowire.ConsumeVarint(b)
2778
return out, errDecode
2789
var coderUint64Ptr = pointerCoderFuncs{
2790
size: sizeUint64Ptr,
2791
marshal: appendUint64Ptr,
2792
unmarshal: consumeUint64Ptr,
2793
merge: mergeUint64Ptr,
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)
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)
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)
2821
return out, errDecode
2824
for _, v := range b {
2830
p.growUint64Slice(count)
2836
if len(b) >= 1 && b[0] < 0x80 {
2839
} else if len(b) >= 2 && b[1] < 128 {
2840
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2843
v, n = protowire.ConsumeVarint(b)
2846
return out, errDecode
2855
if wtyp != protowire.VarintType {
2856
return out, errUnknown
2860
if len(b) >= 1 && b[0] < 0x80 {
2863
} else if len(b) >= 2 && b[1] < 128 {
2864
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2867
v, n = protowire.ConsumeVarint(b)
2870
return out, errDecode
2872
*sp = append(*sp, v)
2877
var coderUint64Slice = pointerCoderFuncs{
2878
size: sizeUint64Slice,
2879
marshal: appendUint64Slice,
2880
unmarshal: consumeUint64Slice,
2881
merge: mergeUint64Slice,
2885
func sizeUint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
2886
s := *p.Uint64Slice()
2891
for _, v := range s {
2892
n += protowire.SizeVarint(v)
2894
return f.tagsize + protowire.SizeBytes(n)
2898
func appendUint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
2899
s := *p.Uint64Slice()
2903
b = protowire.AppendVarint(b, f.wiretag)
2905
for _, v := range s {
2906
n += protowire.SizeVarint(v)
2908
b = protowire.AppendVarint(b, uint64(n))
2909
for _, v := range s {
2910
b = protowire.AppendVarint(b, v)
2915
var coderUint64PackedSlice = pointerCoderFuncs{
2916
size: sizeUint64PackedSlice,
2917
marshal: appendUint64PackedSlice,
2918
unmarshal: consumeUint64Slice,
2919
merge: mergeUint64Slice,
2923
func sizeUint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
2924
return tagsize + protowire.SizeVarint(v.Uint())
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())
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
2941
if len(b) >= 1 && b[0] < 0x80 {
2944
} else if len(b) >= 2 && b[1] < 128 {
2945
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
2948
v, n = protowire.ConsumeVarint(b)
2951
return protoreflect.Value{}, out, errDecode
2954
return protoreflect.ValueOfUint64(v), out, nil
2957
var coderUint64Value = valueCoderFuncs{
2958
size: sizeUint64Value,
2959
marshal: appendUint64Value,
2960
unmarshal: consumeUint64Value,
2961
merge: mergeScalarValue,
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++ {
2969
size += tagsize + protowire.SizeVarint(v.Uint())
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++ {
2979
b = protowire.AppendVarint(b, wiretag)
2980
b = protowire.AppendVarint(b, v.Uint())
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)
2991
return protoreflect.Value{}, out, errDecode
2996
if len(b) >= 1 && b[0] < 0x80 {
2999
} else if len(b) >= 2 && b[1] < 128 {
3000
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
3003
v, n = protowire.ConsumeVarint(b)
3006
return protoreflect.Value{}, out, errDecode
3008
list.Append(protoreflect.ValueOfUint64(v))
3012
return listv, out, nil
3014
if wtyp != protowire.VarintType {
3015
return protoreflect.Value{}, out, errUnknown
3019
if len(b) >= 1 && b[0] < 0x80 {
3022
} else if len(b) >= 2 && b[1] < 128 {
3023
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
3026
v, n = protowire.ConsumeVarint(b)
3029
return protoreflect.Value{}, out, errDecode
3031
list.Append(protoreflect.ValueOfUint64(v))
3033
return listv, out, nil
3036
var coderUint64SliceValue = valueCoderFuncs{
3037
size: sizeUint64SliceValue,
3038
marshal: appendUint64SliceValue,
3039
unmarshal: consumeUint64SliceValue,
3040
merge: mergeListValue,
3044
func sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3045
list := listv.List()
3051
for i, llen := 0, llen; i < llen; i++ {
3053
n += protowire.SizeVarint(v.Uint())
3055
return tagsize + protowire.SizeBytes(n)
3059
func appendUint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3060
list := listv.List()
3065
b = protowire.AppendVarint(b, wiretag)
3067
for i := 0; i < llen; i++ {
3069
n += protowire.SizeVarint(v.Uint())
3071
b = protowire.AppendVarint(b, uint64(n))
3072
for i := 0; i < llen; i++ {
3074
b = protowire.AppendVarint(b, v.Uint())
3079
var coderUint64PackedSliceValue = valueCoderFuncs{
3080
size: sizeUint64PackedSliceValue,
3081
marshal: appendUint64PackedSliceValue,
3082
unmarshal: consumeUint64SliceValue,
3083
merge: mergeListValue,
3087
func sizeSfixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3089
return f.tagsize + protowire.SizeFixed32()
3093
func appendSfixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3095
b = protowire.AppendVarint(b, f.wiretag)
3096
b = protowire.AppendFixed32(b, uint32(v))
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
3105
v, n := protowire.ConsumeFixed32(b)
3107
return out, errDecode
3109
*p.Int32() = int32(v)
3114
var coderSfixed32 = pointerCoderFuncs{
3116
marshal: appendSfixed32,
3117
unmarshal: consumeSfixed32,
3123
func sizeSfixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3128
return f.tagsize + protowire.SizeFixed32()
3133
func appendSfixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3138
b = protowire.AppendVarint(b, f.wiretag)
3139
b = protowire.AppendFixed32(b, uint32(v))
3143
var coderSfixed32NoZero = pointerCoderFuncs{
3144
size: sizeSfixed32NoZero,
3145
marshal: appendSfixed32NoZero,
3146
unmarshal: consumeSfixed32,
3147
merge: mergeInt32NoZero,
3152
func sizeSfixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3153
return f.tagsize + protowire.SizeFixed32()
3158
func appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3160
b = protowire.AppendVarint(b, f.wiretag)
3161
b = protowire.AppendFixed32(b, uint32(v))
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
3170
v, n := protowire.ConsumeFixed32(b)
3172
return out, errDecode
3183
var coderSfixed32Ptr = pointerCoderFuncs{
3184
size: sizeSfixed32Ptr,
3185
marshal: appendSfixed32Ptr,
3186
unmarshal: consumeSfixed32Ptr,
3187
merge: mergeInt32Ptr,
3191
func sizeSfixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3192
s := *p.Int32Slice()
3193
size = len(s) * (f.tagsize + protowire.SizeFixed32())
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))
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)
3213
return out, errDecode
3215
count := len(b) / protowire.SizeFixed32()
3217
p.growInt32Slice(count)
3221
v, n := protowire.ConsumeFixed32(b)
3223
return out, errDecode
3225
s = append(s, int32(v))
3232
if wtyp != protowire.Fixed32Type {
3233
return out, errUnknown
3235
v, n := protowire.ConsumeFixed32(b)
3237
return out, errDecode
3239
*sp = append(*sp, int32(v))
3244
var coderSfixed32Slice = pointerCoderFuncs{
3245
size: sizeSfixed32Slice,
3246
marshal: appendSfixed32Slice,
3247
unmarshal: consumeSfixed32Slice,
3248
merge: mergeInt32Slice,
3252
func sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3253
s := *p.Int32Slice()
3257
n := len(s) * protowire.SizeFixed32()
3258
return f.tagsize + protowire.SizeBytes(n)
3262
func appendSfixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3263
s := *p.Int32Slice()
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))
3276
var coderSfixed32PackedSlice = pointerCoderFuncs{
3277
size: sizeSfixed32PackedSlice,
3278
marshal: appendSfixed32PackedSlice,
3279
unmarshal: consumeSfixed32Slice,
3280
merge: mergeInt32Slice,
3284
func sizeSfixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
3285
return tagsize + protowire.SizeFixed32()
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()))
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
3300
v, n := protowire.ConsumeFixed32(b)
3302
return protoreflect.Value{}, out, errDecode
3305
return protoreflect.ValueOfInt32(int32(v)), out, nil
3308
var coderSfixed32Value = valueCoderFuncs{
3309
size: sizeSfixed32Value,
3310
marshal: appendSfixed32Value,
3311
unmarshal: consumeSfixed32Value,
3312
merge: mergeScalarValue,
3316
func sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3317
list := listv.List()
3318
size = list.Len() * (tagsize + protowire.SizeFixed32())
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++ {
3327
b = protowire.AppendVarint(b, wiretag)
3328
b = protowire.AppendFixed32(b, uint32(v.Int()))
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)
3339
return protoreflect.Value{}, out, errDecode
3342
v, n := protowire.ConsumeFixed32(b)
3344
return protoreflect.Value{}, out, errDecode
3346
list.Append(protoreflect.ValueOfInt32(int32(v)))
3350
return listv, out, nil
3352
if wtyp != protowire.Fixed32Type {
3353
return protoreflect.Value{}, out, errUnknown
3355
v, n := protowire.ConsumeFixed32(b)
3357
return protoreflect.Value{}, out, errDecode
3359
list.Append(protoreflect.ValueOfInt32(int32(v)))
3361
return listv, out, nil
3364
var coderSfixed32SliceValue = valueCoderFuncs{
3365
size: sizeSfixed32SliceValue,
3366
marshal: appendSfixed32SliceValue,
3367
unmarshal: consumeSfixed32SliceValue,
3368
merge: mergeListValue,
3372
func sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3373
list := listv.List()
3378
n := llen * protowire.SizeFixed32()
3379
return tagsize + protowire.SizeBytes(n)
3383
func appendSfixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3384
list := listv.List()
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++ {
3394
b = protowire.AppendFixed32(b, uint32(v.Int()))
3399
var coderSfixed32PackedSliceValue = valueCoderFuncs{
3400
size: sizeSfixed32PackedSliceValue,
3401
marshal: appendSfixed32PackedSliceValue,
3402
unmarshal: consumeSfixed32SliceValue,
3403
merge: mergeListValue,
3407
func sizeFixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3409
return f.tagsize + protowire.SizeFixed32()
3413
func appendFixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3415
b = protowire.AppendVarint(b, f.wiretag)
3416
b = protowire.AppendFixed32(b, v)
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
3425
v, n := protowire.ConsumeFixed32(b)
3427
return out, errDecode
3434
var coderFixed32 = pointerCoderFuncs{
3436
marshal: appendFixed32,
3437
unmarshal: consumeFixed32,
3443
func sizeFixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3448
return f.tagsize + protowire.SizeFixed32()
3453
func appendFixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3458
b = protowire.AppendVarint(b, f.wiretag)
3459
b = protowire.AppendFixed32(b, v)
3463
var coderFixed32NoZero = pointerCoderFuncs{
3464
size: sizeFixed32NoZero,
3465
marshal: appendFixed32NoZero,
3466
unmarshal: consumeFixed32,
3467
merge: mergeUint32NoZero,
3472
func sizeFixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3473
return f.tagsize + protowire.SizeFixed32()
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)
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
3490
v, n := protowire.ConsumeFixed32(b)
3492
return out, errDecode
3503
var coderFixed32Ptr = pointerCoderFuncs{
3504
size: sizeFixed32Ptr,
3505
marshal: appendFixed32Ptr,
3506
unmarshal: consumeFixed32Ptr,
3507
merge: mergeUint32Ptr,
3511
func sizeFixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3512
s := *p.Uint32Slice()
3513
size = len(s) * (f.tagsize + protowire.SizeFixed32())
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)
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)
3533
return out, errDecode
3535
count := len(b) / protowire.SizeFixed32()
3537
p.growUint32Slice(count)
3541
v, n := protowire.ConsumeFixed32(b)
3543
return out, errDecode
3552
if wtyp != protowire.Fixed32Type {
3553
return out, errUnknown
3555
v, n := protowire.ConsumeFixed32(b)
3557
return out, errDecode
3559
*sp = append(*sp, v)
3564
var coderFixed32Slice = pointerCoderFuncs{
3565
size: sizeFixed32Slice,
3566
marshal: appendFixed32Slice,
3567
unmarshal: consumeFixed32Slice,
3568
merge: mergeUint32Slice,
3572
func sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3573
s := *p.Uint32Slice()
3577
n := len(s) * protowire.SizeFixed32()
3578
return f.tagsize + protowire.SizeBytes(n)
3582
func appendFixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3583
s := *p.Uint32Slice()
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)
3596
var coderFixed32PackedSlice = pointerCoderFuncs{
3597
size: sizeFixed32PackedSlice,
3598
marshal: appendFixed32PackedSlice,
3599
unmarshal: consumeFixed32Slice,
3600
merge: mergeUint32Slice,
3604
func sizeFixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
3605
return tagsize + protowire.SizeFixed32()
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()))
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
3620
v, n := protowire.ConsumeFixed32(b)
3622
return protoreflect.Value{}, out, errDecode
3625
return protoreflect.ValueOfUint32(uint32(v)), out, nil
3628
var coderFixed32Value = valueCoderFuncs{
3629
size: sizeFixed32Value,
3630
marshal: appendFixed32Value,
3631
unmarshal: consumeFixed32Value,
3632
merge: mergeScalarValue,
3636
func sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3637
list := listv.List()
3638
size = list.Len() * (tagsize + protowire.SizeFixed32())
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++ {
3647
b = protowire.AppendVarint(b, wiretag)
3648
b = protowire.AppendFixed32(b, uint32(v.Uint()))
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)
3659
return protoreflect.Value{}, out, errDecode
3662
v, n := protowire.ConsumeFixed32(b)
3664
return protoreflect.Value{}, out, errDecode
3666
list.Append(protoreflect.ValueOfUint32(uint32(v)))
3670
return listv, out, nil
3672
if wtyp != protowire.Fixed32Type {
3673
return protoreflect.Value{}, out, errUnknown
3675
v, n := protowire.ConsumeFixed32(b)
3677
return protoreflect.Value{}, out, errDecode
3679
list.Append(protoreflect.ValueOfUint32(uint32(v)))
3681
return listv, out, nil
3684
var coderFixed32SliceValue = valueCoderFuncs{
3685
size: sizeFixed32SliceValue,
3686
marshal: appendFixed32SliceValue,
3687
unmarshal: consumeFixed32SliceValue,
3688
merge: mergeListValue,
3692
func sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3693
list := listv.List()
3698
n := llen * protowire.SizeFixed32()
3699
return tagsize + protowire.SizeBytes(n)
3703
func appendFixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
3704
list := listv.List()
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++ {
3714
b = protowire.AppendFixed32(b, uint32(v.Uint()))
3719
var coderFixed32PackedSliceValue = valueCoderFuncs{
3720
size: sizeFixed32PackedSliceValue,
3721
marshal: appendFixed32PackedSliceValue,
3722
unmarshal: consumeFixed32SliceValue,
3723
merge: mergeListValue,
3727
func sizeFloat(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3729
return f.tagsize + protowire.SizeFixed32()
3733
func appendFloat(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3735
b = protowire.AppendVarint(b, f.wiretag)
3736
b = protowire.AppendFixed32(b, math.Float32bits(v))
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
3745
v, n := protowire.ConsumeFixed32(b)
3747
return out, errDecode
3749
*p.Float32() = math.Float32frombits(v)
3754
var coderFloat = pointerCoderFuncs{
3756
marshal: appendFloat,
3757
unmarshal: consumeFloat,
3758
merge: mergeFloat32,
3763
func sizeFloatNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3765
if v == 0 && !math.Signbit(float64(v)) {
3768
return f.tagsize + protowire.SizeFixed32()
3773
func appendFloatNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3775
if v == 0 && !math.Signbit(float64(v)) {
3778
b = protowire.AppendVarint(b, f.wiretag)
3779
b = protowire.AppendFixed32(b, math.Float32bits(v))
3783
var coderFloatNoZero = pointerCoderFuncs{
3784
size: sizeFloatNoZero,
3785
marshal: appendFloatNoZero,
3786
unmarshal: consumeFloat,
3787
merge: mergeFloat32NoZero,
3792
func sizeFloatPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3793
return f.tagsize + protowire.SizeFixed32()
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))
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
3810
v, n := protowire.ConsumeFixed32(b)
3812
return out, errDecode
3814
vp := p.Float32Ptr()
3818
**vp = math.Float32frombits(v)
3823
var coderFloatPtr = pointerCoderFuncs{
3825
marshal: appendFloatPtr,
3826
unmarshal: consumeFloatPtr,
3827
merge: mergeFloat32Ptr,
3831
func sizeFloatSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3832
s := *p.Float32Slice()
3833
size = len(s) * (f.tagsize + protowire.SizeFixed32())
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))
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)
3853
return out, errDecode
3855
count := len(b) / protowire.SizeFixed32()
3857
p.growFloat32Slice(count)
3861
v, n := protowire.ConsumeFixed32(b)
3863
return out, errDecode
3865
s = append(s, math.Float32frombits(v))
3872
if wtyp != protowire.Fixed32Type {
3873
return out, errUnknown
3875
v, n := protowire.ConsumeFixed32(b)
3877
return out, errDecode
3879
*sp = append(*sp, math.Float32frombits(v))
3884
var coderFloatSlice = pointerCoderFuncs{
3885
size: sizeFloatSlice,
3886
marshal: appendFloatSlice,
3887
unmarshal: consumeFloatSlice,
3888
merge: mergeFloat32Slice,
3892
func sizeFloatPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
3893
s := *p.Float32Slice()
3897
n := len(s) * protowire.SizeFixed32()
3898
return f.tagsize + protowire.SizeBytes(n)
3902
func appendFloatPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
3903
s := *p.Float32Slice()
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))
3916
var coderFloatPackedSlice = pointerCoderFuncs{
3917
size: sizeFloatPackedSlice,
3918
marshal: appendFloatPackedSlice,
3919
unmarshal: consumeFloatSlice,
3920
merge: mergeFloat32Slice,
3924
func sizeFloatValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
3925
return tagsize + protowire.SizeFixed32()
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())))
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
3940
v, n := protowire.ConsumeFixed32(b)
3942
return protoreflect.Value{}, out, errDecode
3945
return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), out, nil
3948
var coderFloatValue = valueCoderFuncs{
3949
size: sizeFloatValue,
3950
marshal: appendFloatValue,
3951
unmarshal: consumeFloatValue,
3952
merge: mergeScalarValue,
3956
func sizeFloatSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
3957
list := listv.List()
3958
size = list.Len() * (tagsize + protowire.SizeFixed32())
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++ {
3967
b = protowire.AppendVarint(b, wiretag)
3968
b = protowire.AppendFixed32(b, math.Float32bits(float32(v.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)
3979
return protoreflect.Value{}, out, errDecode
3982
v, n := protowire.ConsumeFixed32(b)
3984
return protoreflect.Value{}, out, errDecode
3986
list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
3990
return listv, out, nil
3992
if wtyp != protowire.Fixed32Type {
3993
return protoreflect.Value{}, out, errUnknown
3995
v, n := protowire.ConsumeFixed32(b)
3997
return protoreflect.Value{}, out, errDecode
3999
list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
4001
return listv, out, nil
4004
var coderFloatSliceValue = valueCoderFuncs{
4005
size: sizeFloatSliceValue,
4006
marshal: appendFloatSliceValue,
4007
unmarshal: consumeFloatSliceValue,
4008
merge: mergeListValue,
4012
func sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4013
list := listv.List()
4018
n := llen * protowire.SizeFixed32()
4019
return tagsize + protowire.SizeBytes(n)
4023
func appendFloatPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4024
list := listv.List()
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++ {
4034
b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
4039
var coderFloatPackedSliceValue = valueCoderFuncs{
4040
size: sizeFloatPackedSliceValue,
4041
marshal: appendFloatPackedSliceValue,
4042
unmarshal: consumeFloatSliceValue,
4043
merge: mergeListValue,
4047
func sizeSfixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4049
return f.tagsize + protowire.SizeFixed64()
4053
func appendSfixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4055
b = protowire.AppendVarint(b, f.wiretag)
4056
b = protowire.AppendFixed64(b, uint64(v))
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
4065
v, n := protowire.ConsumeFixed64(b)
4067
return out, errDecode
4069
*p.Int64() = int64(v)
4074
var coderSfixed64 = pointerCoderFuncs{
4076
marshal: appendSfixed64,
4077
unmarshal: consumeSfixed64,
4083
func sizeSfixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4088
return f.tagsize + protowire.SizeFixed64()
4093
func appendSfixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4098
b = protowire.AppendVarint(b, f.wiretag)
4099
b = protowire.AppendFixed64(b, uint64(v))
4103
var coderSfixed64NoZero = pointerCoderFuncs{
4104
size: sizeSfixed64NoZero,
4105
marshal: appendSfixed64NoZero,
4106
unmarshal: consumeSfixed64,
4107
merge: mergeInt64NoZero,
4112
func sizeSfixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4113
return f.tagsize + protowire.SizeFixed64()
4118
func appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4120
b = protowire.AppendVarint(b, f.wiretag)
4121
b = protowire.AppendFixed64(b, uint64(v))
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
4130
v, n := protowire.ConsumeFixed64(b)
4132
return out, errDecode
4143
var coderSfixed64Ptr = pointerCoderFuncs{
4144
size: sizeSfixed64Ptr,
4145
marshal: appendSfixed64Ptr,
4146
unmarshal: consumeSfixed64Ptr,
4147
merge: mergeInt64Ptr,
4151
func sizeSfixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4152
s := *p.Int64Slice()
4153
size = len(s) * (f.tagsize + protowire.SizeFixed64())
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))
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)
4173
return out, errDecode
4175
count := len(b) / protowire.SizeFixed64()
4177
p.growInt64Slice(count)
4181
v, n := protowire.ConsumeFixed64(b)
4183
return out, errDecode
4185
s = append(s, int64(v))
4192
if wtyp != protowire.Fixed64Type {
4193
return out, errUnknown
4195
v, n := protowire.ConsumeFixed64(b)
4197
return out, errDecode
4199
*sp = append(*sp, int64(v))
4204
var coderSfixed64Slice = pointerCoderFuncs{
4205
size: sizeSfixed64Slice,
4206
marshal: appendSfixed64Slice,
4207
unmarshal: consumeSfixed64Slice,
4208
merge: mergeInt64Slice,
4212
func sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4213
s := *p.Int64Slice()
4217
n := len(s) * protowire.SizeFixed64()
4218
return f.tagsize + protowire.SizeBytes(n)
4222
func appendSfixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4223
s := *p.Int64Slice()
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))
4236
var coderSfixed64PackedSlice = pointerCoderFuncs{
4237
size: sizeSfixed64PackedSlice,
4238
marshal: appendSfixed64PackedSlice,
4239
unmarshal: consumeSfixed64Slice,
4240
merge: mergeInt64Slice,
4244
func sizeSfixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
4245
return tagsize + protowire.SizeFixed64()
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()))
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
4260
v, n := protowire.ConsumeFixed64(b)
4262
return protoreflect.Value{}, out, errDecode
4265
return protoreflect.ValueOfInt64(int64(v)), out, nil
4268
var coderSfixed64Value = valueCoderFuncs{
4269
size: sizeSfixed64Value,
4270
marshal: appendSfixed64Value,
4271
unmarshal: consumeSfixed64Value,
4272
merge: mergeScalarValue,
4276
func sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4277
list := listv.List()
4278
size = list.Len() * (tagsize + protowire.SizeFixed64())
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++ {
4287
b = protowire.AppendVarint(b, wiretag)
4288
b = protowire.AppendFixed64(b, uint64(v.Int()))
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)
4299
return protoreflect.Value{}, out, errDecode
4302
v, n := protowire.ConsumeFixed64(b)
4304
return protoreflect.Value{}, out, errDecode
4306
list.Append(protoreflect.ValueOfInt64(int64(v)))
4310
return listv, out, nil
4312
if wtyp != protowire.Fixed64Type {
4313
return protoreflect.Value{}, out, errUnknown
4315
v, n := protowire.ConsumeFixed64(b)
4317
return protoreflect.Value{}, out, errDecode
4319
list.Append(protoreflect.ValueOfInt64(int64(v)))
4321
return listv, out, nil
4324
var coderSfixed64SliceValue = valueCoderFuncs{
4325
size: sizeSfixed64SliceValue,
4326
marshal: appendSfixed64SliceValue,
4327
unmarshal: consumeSfixed64SliceValue,
4328
merge: mergeListValue,
4332
func sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4333
list := listv.List()
4338
n := llen * protowire.SizeFixed64()
4339
return tagsize + protowire.SizeBytes(n)
4343
func appendSfixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4344
list := listv.List()
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++ {
4354
b = protowire.AppendFixed64(b, uint64(v.Int()))
4359
var coderSfixed64PackedSliceValue = valueCoderFuncs{
4360
size: sizeSfixed64PackedSliceValue,
4361
marshal: appendSfixed64PackedSliceValue,
4362
unmarshal: consumeSfixed64SliceValue,
4363
merge: mergeListValue,
4367
func sizeFixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4369
return f.tagsize + protowire.SizeFixed64()
4373
func appendFixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4375
b = protowire.AppendVarint(b, f.wiretag)
4376
b = protowire.AppendFixed64(b, v)
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
4385
v, n := protowire.ConsumeFixed64(b)
4387
return out, errDecode
4394
var coderFixed64 = pointerCoderFuncs{
4396
marshal: appendFixed64,
4397
unmarshal: consumeFixed64,
4403
func sizeFixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4408
return f.tagsize + protowire.SizeFixed64()
4413
func appendFixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4418
b = protowire.AppendVarint(b, f.wiretag)
4419
b = protowire.AppendFixed64(b, v)
4423
var coderFixed64NoZero = pointerCoderFuncs{
4424
size: sizeFixed64NoZero,
4425
marshal: appendFixed64NoZero,
4426
unmarshal: consumeFixed64,
4427
merge: mergeUint64NoZero,
4432
func sizeFixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4433
return f.tagsize + protowire.SizeFixed64()
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)
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
4450
v, n := protowire.ConsumeFixed64(b)
4452
return out, errDecode
4463
var coderFixed64Ptr = pointerCoderFuncs{
4464
size: sizeFixed64Ptr,
4465
marshal: appendFixed64Ptr,
4466
unmarshal: consumeFixed64Ptr,
4467
merge: mergeUint64Ptr,
4471
func sizeFixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4472
s := *p.Uint64Slice()
4473
size = len(s) * (f.tagsize + protowire.SizeFixed64())
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)
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)
4493
return out, errDecode
4495
count := len(b) / protowire.SizeFixed64()
4497
p.growUint64Slice(count)
4501
v, n := protowire.ConsumeFixed64(b)
4503
return out, errDecode
4512
if wtyp != protowire.Fixed64Type {
4513
return out, errUnknown
4515
v, n := protowire.ConsumeFixed64(b)
4517
return out, errDecode
4519
*sp = append(*sp, v)
4524
var coderFixed64Slice = pointerCoderFuncs{
4525
size: sizeFixed64Slice,
4526
marshal: appendFixed64Slice,
4527
unmarshal: consumeFixed64Slice,
4528
merge: mergeUint64Slice,
4532
func sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4533
s := *p.Uint64Slice()
4537
n := len(s) * protowire.SizeFixed64()
4538
return f.tagsize + protowire.SizeBytes(n)
4542
func appendFixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4543
s := *p.Uint64Slice()
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)
4556
var coderFixed64PackedSlice = pointerCoderFuncs{
4557
size: sizeFixed64PackedSlice,
4558
marshal: appendFixed64PackedSlice,
4559
unmarshal: consumeFixed64Slice,
4560
merge: mergeUint64Slice,
4564
func sizeFixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
4565
return tagsize + protowire.SizeFixed64()
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())
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
4580
v, n := protowire.ConsumeFixed64(b)
4582
return protoreflect.Value{}, out, errDecode
4585
return protoreflect.ValueOfUint64(v), out, nil
4588
var coderFixed64Value = valueCoderFuncs{
4589
size: sizeFixed64Value,
4590
marshal: appendFixed64Value,
4591
unmarshal: consumeFixed64Value,
4592
merge: mergeScalarValue,
4596
func sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4597
list := listv.List()
4598
size = list.Len() * (tagsize + protowire.SizeFixed64())
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++ {
4607
b = protowire.AppendVarint(b, wiretag)
4608
b = protowire.AppendFixed64(b, v.Uint())
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)
4619
return protoreflect.Value{}, out, errDecode
4622
v, n := protowire.ConsumeFixed64(b)
4624
return protoreflect.Value{}, out, errDecode
4626
list.Append(protoreflect.ValueOfUint64(v))
4630
return listv, out, nil
4632
if wtyp != protowire.Fixed64Type {
4633
return protoreflect.Value{}, out, errUnknown
4635
v, n := protowire.ConsumeFixed64(b)
4637
return protoreflect.Value{}, out, errDecode
4639
list.Append(protoreflect.ValueOfUint64(v))
4641
return listv, out, nil
4644
var coderFixed64SliceValue = valueCoderFuncs{
4645
size: sizeFixed64SliceValue,
4646
marshal: appendFixed64SliceValue,
4647
unmarshal: consumeFixed64SliceValue,
4648
merge: mergeListValue,
4652
func sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4653
list := listv.List()
4658
n := llen * protowire.SizeFixed64()
4659
return tagsize + protowire.SizeBytes(n)
4663
func appendFixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4664
list := listv.List()
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++ {
4674
b = protowire.AppendFixed64(b, v.Uint())
4679
var coderFixed64PackedSliceValue = valueCoderFuncs{
4680
size: sizeFixed64PackedSliceValue,
4681
marshal: appendFixed64PackedSliceValue,
4682
unmarshal: consumeFixed64SliceValue,
4683
merge: mergeListValue,
4687
func sizeDouble(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4689
return f.tagsize + protowire.SizeFixed64()
4693
func appendDouble(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4695
b = protowire.AppendVarint(b, f.wiretag)
4696
b = protowire.AppendFixed64(b, math.Float64bits(v))
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
4705
v, n := protowire.ConsumeFixed64(b)
4707
return out, errDecode
4709
*p.Float64() = math.Float64frombits(v)
4714
var coderDouble = pointerCoderFuncs{
4716
marshal: appendDouble,
4717
unmarshal: consumeDouble,
4718
merge: mergeFloat64,
4723
func sizeDoubleNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4725
if v == 0 && !math.Signbit(float64(v)) {
4728
return f.tagsize + protowire.SizeFixed64()
4733
func appendDoubleNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4735
if v == 0 && !math.Signbit(float64(v)) {
4738
b = protowire.AppendVarint(b, f.wiretag)
4739
b = protowire.AppendFixed64(b, math.Float64bits(v))
4743
var coderDoubleNoZero = pointerCoderFuncs{
4744
size: sizeDoubleNoZero,
4745
marshal: appendDoubleNoZero,
4746
unmarshal: consumeDouble,
4747
merge: mergeFloat64NoZero,
4752
func sizeDoublePtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4753
return f.tagsize + protowire.SizeFixed64()
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))
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
4770
v, n := protowire.ConsumeFixed64(b)
4772
return out, errDecode
4774
vp := p.Float64Ptr()
4778
**vp = math.Float64frombits(v)
4783
var coderDoublePtr = pointerCoderFuncs{
4784
size: sizeDoublePtr,
4785
marshal: appendDoublePtr,
4786
unmarshal: consumeDoublePtr,
4787
merge: mergeFloat64Ptr,
4791
func sizeDoubleSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4792
s := *p.Float64Slice()
4793
size = len(s) * (f.tagsize + protowire.SizeFixed64())
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))
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)
4813
return out, errDecode
4815
count := len(b) / protowire.SizeFixed64()
4817
p.growFloat64Slice(count)
4821
v, n := protowire.ConsumeFixed64(b)
4823
return out, errDecode
4825
s = append(s, math.Float64frombits(v))
4832
if wtyp != protowire.Fixed64Type {
4833
return out, errUnknown
4835
v, n := protowire.ConsumeFixed64(b)
4837
return out, errDecode
4839
*sp = append(*sp, math.Float64frombits(v))
4844
var coderDoubleSlice = pointerCoderFuncs{
4845
size: sizeDoubleSlice,
4846
marshal: appendDoubleSlice,
4847
unmarshal: consumeDoubleSlice,
4848
merge: mergeFloat64Slice,
4852
func sizeDoublePackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
4853
s := *p.Float64Slice()
4857
n := len(s) * protowire.SizeFixed64()
4858
return f.tagsize + protowire.SizeBytes(n)
4862
func appendDoublePackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
4863
s := *p.Float64Slice()
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))
4876
var coderDoublePackedSlice = pointerCoderFuncs{
4877
size: sizeDoublePackedSlice,
4878
marshal: appendDoublePackedSlice,
4879
unmarshal: consumeDoubleSlice,
4880
merge: mergeFloat64Slice,
4884
func sizeDoubleValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
4885
return tagsize + protowire.SizeFixed64()
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()))
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
4900
v, n := protowire.ConsumeFixed64(b)
4902
return protoreflect.Value{}, out, errDecode
4905
return protoreflect.ValueOfFloat64(math.Float64frombits(v)), out, nil
4908
var coderDoubleValue = valueCoderFuncs{
4909
size: sizeDoubleValue,
4910
marshal: appendDoubleValue,
4911
unmarshal: consumeDoubleValue,
4912
merge: mergeScalarValue,
4916
func sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4917
list := listv.List()
4918
size = list.Len() * (tagsize + protowire.SizeFixed64())
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++ {
4927
b = protowire.AppendVarint(b, wiretag)
4928
b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
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)
4939
return protoreflect.Value{}, out, errDecode
4942
v, n := protowire.ConsumeFixed64(b)
4944
return protoreflect.Value{}, out, errDecode
4946
list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
4950
return listv, out, nil
4952
if wtyp != protowire.Fixed64Type {
4953
return protoreflect.Value{}, out, errUnknown
4955
v, n := protowire.ConsumeFixed64(b)
4957
return protoreflect.Value{}, out, errDecode
4959
list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
4961
return listv, out, nil
4964
var coderDoubleSliceValue = valueCoderFuncs{
4965
size: sizeDoubleSliceValue,
4966
marshal: appendDoubleSliceValue,
4967
unmarshal: consumeDoubleSliceValue,
4968
merge: mergeListValue,
4972
func sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
4973
list := listv.List()
4978
n := llen * protowire.SizeFixed64()
4979
return tagsize + protowire.SizeBytes(n)
4983
func appendDoublePackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
4984
list := listv.List()
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++ {
4994
b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
4999
var coderDoublePackedSliceValue = valueCoderFuncs{
5000
size: sizeDoublePackedSliceValue,
5001
marshal: appendDoublePackedSliceValue,
5002
unmarshal: consumeDoubleSliceValue,
5003
merge: mergeListValue,
5007
func sizeString(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5009
return f.tagsize + protowire.SizeBytes(len(v))
5013
func appendString(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5015
b = protowire.AppendVarint(b, f.wiretag)
5016
b = protowire.AppendString(b, v)
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
5025
v, n := protowire.ConsumeBytes(b)
5027
return out, errDecode
5029
*p.String() = string(v)
5034
var coderString = pointerCoderFuncs{
5036
marshal: appendString,
5037
unmarshal: consumeString,
5042
func appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5044
b = protowire.AppendVarint(b, f.wiretag)
5045
b = protowire.AppendString(b, v)
5046
if !utf8.ValidString(v) {
5047
return b, errInvalidUTF8{}
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
5057
v, n := protowire.ConsumeBytes(b)
5059
return out, errDecode
5062
return out, errInvalidUTF8{}
5064
*p.String() = string(v)
5069
var coderStringValidateUTF8 = pointerCoderFuncs{
5071
marshal: appendStringValidateUTF8,
5072
unmarshal: consumeStringValidateUTF8,
5078
func sizeStringNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5083
return f.tagsize + protowire.SizeBytes(len(v))
5088
func appendStringNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5093
b = protowire.AppendVarint(b, f.wiretag)
5094
b = protowire.AppendString(b, v)
5098
var coderStringNoZero = pointerCoderFuncs{
5099
size: sizeStringNoZero,
5100
marshal: appendStringNoZero,
5101
unmarshal: consumeString,
5102
merge: mergeStringNoZero,
5107
func appendStringNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5112
b = protowire.AppendVarint(b, f.wiretag)
5113
b = protowire.AppendString(b, v)
5114
if !utf8.ValidString(v) {
5115
return b, errInvalidUTF8{}
5120
var coderStringNoZeroValidateUTF8 = pointerCoderFuncs{
5121
size: sizeStringNoZero,
5122
marshal: appendStringNoZeroValidateUTF8,
5123
unmarshal: consumeStringValidateUTF8,
5124
merge: mergeStringNoZero,
5129
func sizeStringPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5130
v := **p.StringPtr()
5131
return f.tagsize + protowire.SizeBytes(len(v))
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)
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
5148
v, n := protowire.ConsumeBytes(b)
5150
return out, errDecode
5161
var coderStringPtr = pointerCoderFuncs{
5162
size: sizeStringPtr,
5163
marshal: appendStringPtr,
5164
unmarshal: consumeStringPtr,
5165
merge: mergeStringPtr,
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{}
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
5185
v, n := protowire.ConsumeBytes(b)
5187
return out, errDecode
5190
return out, errInvalidUTF8{}
5201
var coderStringPtrValidateUTF8 = pointerCoderFuncs{
5202
size: sizeStringPtr,
5203
marshal: appendStringPtrValidateUTF8,
5204
unmarshal: consumeStringPtrValidateUTF8,
5205
merge: mergeStringPtr,
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))
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)
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
5233
v, n := protowire.ConsumeBytes(b)
5235
return out, errDecode
5237
*sp = append(*sp, string(v))
5242
var coderStringSlice = pointerCoderFuncs{
5243
size: sizeStringSlice,
5244
marshal: appendStringSlice,
5245
unmarshal: consumeStringSlice,
5246
merge: mergeStringSlice,
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{}
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
5267
v, n := protowire.ConsumeBytes(b)
5269
return out, errDecode
5272
return out, errInvalidUTF8{}
5274
sp := p.StringSlice()
5275
*sp = append(*sp, string(v))
5280
var coderStringSliceValidateUTF8 = pointerCoderFuncs{
5281
size: sizeStringSlice,
5282
marshal: appendStringSliceValidateUTF8,
5283
unmarshal: consumeStringSliceValidateUTF8,
5284
merge: mergeStringSlice,
5288
func sizeStringValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
5289
return tagsize + protowire.SizeBytes(len(v.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())
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
5304
v, n := protowire.ConsumeBytes(b)
5306
return protoreflect.Value{}, out, errDecode
5309
return protoreflect.ValueOfString(string(v)), out, nil
5312
var coderStringValue = valueCoderFuncs{
5313
size: sizeStringValue,
5314
marshal: appendStringValue,
5315
unmarshal: consumeStringValue,
5316
merge: mergeScalarValue,
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{}
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
5334
v, n := protowire.ConsumeBytes(b)
5336
return protoreflect.Value{}, out, errDecode
5339
return protoreflect.Value{}, out, errInvalidUTF8{}
5342
return protoreflect.ValueOfString(string(v)), out, nil
5345
var coderStringValueValidateUTF8 = valueCoderFuncs{
5346
size: sizeStringValue,
5347
marshal: appendStringValueValidateUTF8,
5348
unmarshal: consumeStringValueValidateUTF8,
5349
merge: mergeScalarValue,
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++ {
5357
size += tagsize + protowire.SizeBytes(len(v.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++ {
5367
b = protowire.AppendVarint(b, wiretag)
5368
b = protowire.AppendString(b, v.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
5379
v, n := protowire.ConsumeBytes(b)
5381
return protoreflect.Value{}, out, errDecode
5383
list.Append(protoreflect.ValueOfString(string(v)))
5385
return listv, out, nil
5388
var coderStringSliceValue = valueCoderFuncs{
5389
size: sizeStringSliceValue,
5390
marshal: appendStringSliceValue,
5391
unmarshal: consumeStringSliceValue,
5392
merge: mergeListValue,
5396
func sizeBytes(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5398
return f.tagsize + protowire.SizeBytes(len(v))
5402
func appendBytes(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5404
b = protowire.AppendVarint(b, f.wiretag)
5405
b = protowire.AppendBytes(b, v)
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
5414
v, n := protowire.ConsumeBytes(b)
5416
return out, errDecode
5418
*p.Bytes() = append(emptyBuf[:], v...)
5423
var coderBytes = pointerCoderFuncs{
5425
marshal: appendBytes,
5426
unmarshal: consumeBytes,
5431
func appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5433
b = protowire.AppendVarint(b, f.wiretag)
5434
b = protowire.AppendBytes(b, v)
5436
return b, errInvalidUTF8{}
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
5446
v, n := protowire.ConsumeBytes(b)
5448
return out, errDecode
5451
return out, errInvalidUTF8{}
5453
*p.Bytes() = append(emptyBuf[:], v...)
5458
var coderBytesValidateUTF8 = pointerCoderFuncs{
5460
marshal: appendBytesValidateUTF8,
5461
unmarshal: consumeBytesValidateUTF8,
5467
func sizeBytesNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
5472
return f.tagsize + protowire.SizeBytes(len(v))
5477
func appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5482
b = protowire.AppendVarint(b, f.wiretag)
5483
b = protowire.AppendBytes(b, v)
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
5493
v, n := protowire.ConsumeBytes(b)
5495
return out, errDecode
5497
*p.Bytes() = append(([]byte)(nil), v...)
5502
var coderBytesNoZero = pointerCoderFuncs{
5503
size: sizeBytesNoZero,
5504
marshal: appendBytesNoZero,
5505
unmarshal: consumeBytesNoZero,
5506
merge: mergeBytesNoZero,
5511
func appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
5516
b = protowire.AppendVarint(b, f.wiretag)
5517
b = protowire.AppendBytes(b, v)
5519
return b, errInvalidUTF8{}
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
5529
v, n := protowire.ConsumeBytes(b)
5531
return out, errDecode
5534
return out, errInvalidUTF8{}
5536
*p.Bytes() = append(([]byte)(nil), v...)
5541
var coderBytesNoZeroValidateUTF8 = pointerCoderFuncs{
5542
size: sizeBytesNoZero,
5543
marshal: appendBytesNoZeroValidateUTF8,
5544
unmarshal: consumeBytesNoZeroValidateUTF8,
5545
merge: mergeBytesNoZero,
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))
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)
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
5573
v, n := protowire.ConsumeBytes(b)
5575
return out, errDecode
5577
*sp = append(*sp, append(emptyBuf[:], v...))
5582
var coderBytesSlice = pointerCoderFuncs{
5583
size: sizeBytesSlice,
5584
marshal: appendBytesSlice,
5585
unmarshal: consumeBytesSlice,
5586
merge: mergeBytesSlice,
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)
5596
return b, errInvalidUTF8{}
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
5607
v, n := protowire.ConsumeBytes(b)
5609
return out, errDecode
5612
return out, errInvalidUTF8{}
5614
sp := p.BytesSlice()
5615
*sp = append(*sp, append(emptyBuf[:], v...))
5620
var coderBytesSliceValidateUTF8 = pointerCoderFuncs{
5621
size: sizeBytesSlice,
5622
marshal: appendBytesSliceValidateUTF8,
5623
unmarshal: consumeBytesSliceValidateUTF8,
5624
merge: mergeBytesSlice,
5628
func sizeBytesValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
5629
return tagsize + protowire.SizeBytes(len(v.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())
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
5644
v, n := protowire.ConsumeBytes(b)
5646
return protoreflect.Value{}, out, errDecode
5649
return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), out, nil
5652
var coderBytesValue = valueCoderFuncs{
5653
size: sizeBytesValue,
5654
marshal: appendBytesValue,
5655
unmarshal: consumeBytesValue,
5656
merge: mergeBytesValue,
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++ {
5664
size += tagsize + protowire.SizeBytes(len(v.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++ {
5674
b = protowire.AppendVarint(b, wiretag)
5675
b = protowire.AppendBytes(b, v.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
5686
v, n := protowire.ConsumeBytes(b)
5688
return protoreflect.Value{}, out, errDecode
5690
list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))
5692
return listv, out, nil
5695
var coderBytesSliceValue = valueCoderFuncs{
5696
size: sizeBytesSliceValue,
5697
marshal: appendBytesSliceValue,
5698
unmarshal: consumeBytesSliceValue,
5699
merge: mergeBytesListValue,
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,