blob: 6f5532385d1af8b9f4bccc650bda3455fbe92cb2 [file] [log] [blame]
Damien Neilc37adef2019-04-01 13:49:56 -07001// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style.
3// license that can be found in the LICENSE file.
4
5// Code generated by generate-types. DO NOT EDIT.
6
7package impl
8
9import (
10 "math"
11
12 "google.golang.org/protobuf/internal/encoding/wire"
13 "google.golang.org/protobuf/reflect/protoreflect"
14)
15
16// sizeBool returns the size of wire encoding a bool pointer as a Bool.
17func sizeBool(p pointer, tagsize int, _ marshalOptions) (size int) {
18 v := *p.Bool()
19 return tagsize + wire.SizeVarint(wire.EncodeBool(v))
20}
21
22// appendBool wire encodes a bool pointer as a Bool.
23func appendBool(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
24 v := *p.Bool()
25 b = wire.AppendVarint(b, wiretag)
26 b = wire.AppendVarint(b, wire.EncodeBool(v))
27 return b, nil
28}
29
30var coderBool = pointerCoderFuncs{
31 size: sizeBool,
32 marshal: appendBool,
33}
34
35// sizeBool returns the size of wire encoding a bool pointer as a Bool.
36// The zero value is not encoded.
37func sizeBoolNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
38 v := *p.Bool()
39 if v == false {
40 return 0
41 }
42 return tagsize + wire.SizeVarint(wire.EncodeBool(v))
43}
44
45// appendBool wire encodes a bool pointer as a Bool.
46// The zero value is not encoded.
47func appendBoolNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
48 v := *p.Bool()
49 if v == false {
50 return b, nil
51 }
52 b = wire.AppendVarint(b, wiretag)
53 b = wire.AppendVarint(b, wire.EncodeBool(v))
54 return b, nil
55}
56
57var coderBoolNoZero = pointerCoderFuncs{
58 size: sizeBoolNoZero,
59 marshal: appendBoolNoZero,
60}
61
62// sizeBoolPtr returns the size of wire encoding a *bool pointer as a Bool.
63// It panics if the pointer is nil.
64func sizeBoolPtr(p pointer, tagsize int, _ marshalOptions) (size int) {
65 v := **p.BoolPtr()
66 return tagsize + wire.SizeVarint(wire.EncodeBool(v))
67}
68
69// appendBool wire encodes a *bool pointer as a Bool.
70// It panics if the pointer is nil.
71func appendBoolPtr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
72 v := **p.BoolPtr()
73 b = wire.AppendVarint(b, wiretag)
74 b = wire.AppendVarint(b, wire.EncodeBool(v))
75 return b, nil
76}
77
78var coderBoolPtr = pointerCoderFuncs{
79 size: sizeBoolPtr,
80 marshal: appendBoolPtr,
81}
82
83// sizeBoolSlice returns the size of wire encoding a []bool pointer as a repeated Bool.
84func sizeBoolSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
85 s := *p.BoolSlice()
86 for _, v := range s {
87 size += tagsize + wire.SizeVarint(wire.EncodeBool(v))
88 }
89 return size
90}
91
92// appendBoolSlice encodes a []bool pointer as a repeated Bool.
93func appendBoolSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
94 s := *p.BoolSlice()
95 for _, v := range s {
96 b = wire.AppendVarint(b, wiretag)
97 b = wire.AppendVarint(b, wire.EncodeBool(v))
98 }
99 return b, nil
100}
101
102var coderBoolSlice = pointerCoderFuncs{
103 size: sizeBoolSlice,
104 marshal: appendBoolSlice,
105}
106
107// sizeBoolPackedSlice returns the size of wire encoding a []bool pointer as a packed repeated Bool.
108func sizeBoolPackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
109 s := *p.BoolSlice()
110 if len(s) == 0 {
111 return 0
112 }
113 n := 0
114 for _, v := range s {
115 n += wire.SizeVarint(wire.EncodeBool(v))
116 }
117 return tagsize + wire.SizeBytes(n)
118}
119
120// appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool.
121func appendBoolPackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
122 s := *p.BoolSlice()
123 if len(s) == 0 {
124 return b, nil
125 }
126 b = wire.AppendVarint(b, wiretag)
127 n := 0
128 for _, v := range s {
129 n += wire.SizeVarint(wire.EncodeBool(v))
130 }
131 b = wire.AppendVarint(b, uint64(n))
132 for _, v := range s {
133 b = wire.AppendVarint(b, wire.EncodeBool(v))
134 }
135 return b, nil
136}
137
138var coderBoolPackedSlice = pointerCoderFuncs{
139 size: sizeBoolPackedSlice,
140 marshal: appendBoolPackedSlice,
141}
142
143// sizeBoolIface returns the size of wire encoding a bool value as a Bool.
144func sizeBoolIface(ival interface{}, tagsize int, _ marshalOptions) int {
145 v := ival.(bool)
146 return tagsize + wire.SizeVarint(wire.EncodeBool(v))
147}
148
149// appendBoolIface encodes a bool value as a Bool.
150func appendBoolIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
151 v := ival.(bool)
152 b = wire.AppendVarint(b, wiretag)
153 b = wire.AppendVarint(b, wire.EncodeBool(v))
154 return b, nil
155}
156
157var coderBoolIface = ifaceCoderFuncs{
158 size: sizeBoolIface,
159 marshal: appendBoolIface,
160}
161
162// sizeBoolSliceIface returns the size of wire encoding a []bool value as a repeated Bool.
163func sizeBoolSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
164 s := *ival.(*[]bool)
165 for _, v := range s {
166 size += tagsize + wire.SizeVarint(wire.EncodeBool(v))
167 }
168 return size
169}
170
171// appendBoolSliceIface encodes a []bool value as a repeated Bool.
172func appendBoolSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
173 s := *ival.(*[]bool)
174 for _, v := range s {
175 b = wire.AppendVarint(b, wiretag)
176 b = wire.AppendVarint(b, wire.EncodeBool(v))
177 }
178 return b, nil
179}
180
181var coderBoolSliceIface = ifaceCoderFuncs{
182 size: sizeBoolSliceIface,
183 marshal: appendBoolSliceIface,
184}
185
186// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.
187func sizeInt32(p pointer, tagsize int, _ marshalOptions) (size int) {
188 v := *p.Int32()
189 return tagsize + wire.SizeVarint(uint64(v))
190}
191
192// appendInt32 wire encodes a int32 pointer as a Int32.
193func appendInt32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
194 v := *p.Int32()
195 b = wire.AppendVarint(b, wiretag)
196 b = wire.AppendVarint(b, uint64(v))
197 return b, nil
198}
199
200var coderInt32 = pointerCoderFuncs{
201 size: sizeInt32,
202 marshal: appendInt32,
203}
204
205// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.
206// The zero value is not encoded.
207func sizeInt32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
208 v := *p.Int32()
209 if v == 0 {
210 return 0
211 }
212 return tagsize + wire.SizeVarint(uint64(v))
213}
214
215// appendInt32 wire encodes a int32 pointer as a Int32.
216// The zero value is not encoded.
217func appendInt32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
218 v := *p.Int32()
219 if v == 0 {
220 return b, nil
221 }
222 b = wire.AppendVarint(b, wiretag)
223 b = wire.AppendVarint(b, uint64(v))
224 return b, nil
225}
226
227var coderInt32NoZero = pointerCoderFuncs{
228 size: sizeInt32NoZero,
229 marshal: appendInt32NoZero,
230}
231
232// sizeInt32Ptr returns the size of wire encoding a *int32 pointer as a Int32.
233// It panics if the pointer is nil.
234func sizeInt32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
235 v := **p.Int32Ptr()
236 return tagsize + wire.SizeVarint(uint64(v))
237}
238
239// appendInt32 wire encodes a *int32 pointer as a Int32.
240// It panics if the pointer is nil.
241func appendInt32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
242 v := **p.Int32Ptr()
243 b = wire.AppendVarint(b, wiretag)
244 b = wire.AppendVarint(b, uint64(v))
245 return b, nil
246}
247
248var coderInt32Ptr = pointerCoderFuncs{
249 size: sizeInt32Ptr,
250 marshal: appendInt32Ptr,
251}
252
253// sizeInt32Slice returns the size of wire encoding a []int32 pointer as a repeated Int32.
254func sizeInt32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
255 s := *p.Int32Slice()
256 for _, v := range s {
257 size += tagsize + wire.SizeVarint(uint64(v))
258 }
259 return size
260}
261
262// appendInt32Slice encodes a []int32 pointer as a repeated Int32.
263func appendInt32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
264 s := *p.Int32Slice()
265 for _, v := range s {
266 b = wire.AppendVarint(b, wiretag)
267 b = wire.AppendVarint(b, uint64(v))
268 }
269 return b, nil
270}
271
272var coderInt32Slice = pointerCoderFuncs{
273 size: sizeInt32Slice,
274 marshal: appendInt32Slice,
275}
276
277// sizeInt32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Int32.
278func sizeInt32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
279 s := *p.Int32Slice()
280 if len(s) == 0 {
281 return 0
282 }
283 n := 0
284 for _, v := range s {
285 n += wire.SizeVarint(uint64(v))
286 }
287 return tagsize + wire.SizeBytes(n)
288}
289
290// appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32.
291func appendInt32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
292 s := *p.Int32Slice()
293 if len(s) == 0 {
294 return b, nil
295 }
296 b = wire.AppendVarint(b, wiretag)
297 n := 0
298 for _, v := range s {
299 n += wire.SizeVarint(uint64(v))
300 }
301 b = wire.AppendVarint(b, uint64(n))
302 for _, v := range s {
303 b = wire.AppendVarint(b, uint64(v))
304 }
305 return b, nil
306}
307
308var coderInt32PackedSlice = pointerCoderFuncs{
309 size: sizeInt32PackedSlice,
310 marshal: appendInt32PackedSlice,
311}
312
313// sizeInt32Iface returns the size of wire encoding a int32 value as a Int32.
314func sizeInt32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
315 v := ival.(int32)
316 return tagsize + wire.SizeVarint(uint64(v))
317}
318
319// appendInt32Iface encodes a int32 value as a Int32.
320func appendInt32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
321 v := ival.(int32)
322 b = wire.AppendVarint(b, wiretag)
323 b = wire.AppendVarint(b, uint64(v))
324 return b, nil
325}
326
327var coderInt32Iface = ifaceCoderFuncs{
328 size: sizeInt32Iface,
329 marshal: appendInt32Iface,
330}
331
332// sizeInt32SliceIface returns the size of wire encoding a []int32 value as a repeated Int32.
333func sizeInt32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
334 s := *ival.(*[]int32)
335 for _, v := range s {
336 size += tagsize + wire.SizeVarint(uint64(v))
337 }
338 return size
339}
340
341// appendInt32SliceIface encodes a []int32 value as a repeated Int32.
342func appendInt32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
343 s := *ival.(*[]int32)
344 for _, v := range s {
345 b = wire.AppendVarint(b, wiretag)
346 b = wire.AppendVarint(b, uint64(v))
347 }
348 return b, nil
349}
350
351var coderInt32SliceIface = ifaceCoderFuncs{
352 size: sizeInt32SliceIface,
353 marshal: appendInt32SliceIface,
354}
355
356// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.
357func sizeSint32(p pointer, tagsize int, _ marshalOptions) (size int) {
358 v := *p.Int32()
359 return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
360}
361
362// appendSint32 wire encodes a int32 pointer as a Sint32.
363func appendSint32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
364 v := *p.Int32()
365 b = wire.AppendVarint(b, wiretag)
366 b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
367 return b, nil
368}
369
370var coderSint32 = pointerCoderFuncs{
371 size: sizeSint32,
372 marshal: appendSint32,
373}
374
375// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.
376// The zero value is not encoded.
377func sizeSint32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
378 v := *p.Int32()
379 if v == 0 {
380 return 0
381 }
382 return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
383}
384
385// appendSint32 wire encodes a int32 pointer as a Sint32.
386// The zero value is not encoded.
387func appendSint32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
388 v := *p.Int32()
389 if v == 0 {
390 return b, nil
391 }
392 b = wire.AppendVarint(b, wiretag)
393 b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
394 return b, nil
395}
396
397var coderSint32NoZero = pointerCoderFuncs{
398 size: sizeSint32NoZero,
399 marshal: appendSint32NoZero,
400}
401
402// sizeSint32Ptr returns the size of wire encoding a *int32 pointer as a Sint32.
403// It panics if the pointer is nil.
404func sizeSint32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
405 v := **p.Int32Ptr()
406 return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
407}
408
409// appendSint32 wire encodes a *int32 pointer as a Sint32.
410// It panics if the pointer is nil.
411func appendSint32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
412 v := **p.Int32Ptr()
413 b = wire.AppendVarint(b, wiretag)
414 b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
415 return b, nil
416}
417
418var coderSint32Ptr = pointerCoderFuncs{
419 size: sizeSint32Ptr,
420 marshal: appendSint32Ptr,
421}
422
423// sizeSint32Slice returns the size of wire encoding a []int32 pointer as a repeated Sint32.
424func sizeSint32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
425 s := *p.Int32Slice()
426 for _, v := range s {
427 size += tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
428 }
429 return size
430}
431
432// appendSint32Slice encodes a []int32 pointer as a repeated Sint32.
433func appendSint32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
434 s := *p.Int32Slice()
435 for _, v := range s {
436 b = wire.AppendVarint(b, wiretag)
437 b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
438 }
439 return b, nil
440}
441
442var coderSint32Slice = pointerCoderFuncs{
443 size: sizeSint32Slice,
444 marshal: appendSint32Slice,
445}
446
447// sizeSint32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sint32.
448func sizeSint32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
449 s := *p.Int32Slice()
450 if len(s) == 0 {
451 return 0
452 }
453 n := 0
454 for _, v := range s {
455 n += wire.SizeVarint(wire.EncodeZigZag(int64(v)))
456 }
457 return tagsize + wire.SizeBytes(n)
458}
459
460// appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32.
461func appendSint32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
462 s := *p.Int32Slice()
463 if len(s) == 0 {
464 return b, nil
465 }
466 b = wire.AppendVarint(b, wiretag)
467 n := 0
468 for _, v := range s {
469 n += wire.SizeVarint(wire.EncodeZigZag(int64(v)))
470 }
471 b = wire.AppendVarint(b, uint64(n))
472 for _, v := range s {
473 b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
474 }
475 return b, nil
476}
477
478var coderSint32PackedSlice = pointerCoderFuncs{
479 size: sizeSint32PackedSlice,
480 marshal: appendSint32PackedSlice,
481}
482
483// sizeSint32Iface returns the size of wire encoding a int32 value as a Sint32.
484func sizeSint32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
485 v := ival.(int32)
486 return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
487}
488
489// appendSint32Iface encodes a int32 value as a Sint32.
490func appendSint32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
491 v := ival.(int32)
492 b = wire.AppendVarint(b, wiretag)
493 b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
494 return b, nil
495}
496
497var coderSint32Iface = ifaceCoderFuncs{
498 size: sizeSint32Iface,
499 marshal: appendSint32Iface,
500}
501
502// sizeSint32SliceIface returns the size of wire encoding a []int32 value as a repeated Sint32.
503func sizeSint32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
504 s := *ival.(*[]int32)
505 for _, v := range s {
506 size += tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
507 }
508 return size
509}
510
511// appendSint32SliceIface encodes a []int32 value as a repeated Sint32.
512func appendSint32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
513 s := *ival.(*[]int32)
514 for _, v := range s {
515 b = wire.AppendVarint(b, wiretag)
516 b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
517 }
518 return b, nil
519}
520
521var coderSint32SliceIface = ifaceCoderFuncs{
522 size: sizeSint32SliceIface,
523 marshal: appendSint32SliceIface,
524}
525
526// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.
527func sizeUint32(p pointer, tagsize int, _ marshalOptions) (size int) {
528 v := *p.Uint32()
529 return tagsize + wire.SizeVarint(uint64(v))
530}
531
532// appendUint32 wire encodes a uint32 pointer as a Uint32.
533func appendUint32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
534 v := *p.Uint32()
535 b = wire.AppendVarint(b, wiretag)
536 b = wire.AppendVarint(b, uint64(v))
537 return b, nil
538}
539
540var coderUint32 = pointerCoderFuncs{
541 size: sizeUint32,
542 marshal: appendUint32,
543}
544
545// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.
546// The zero value is not encoded.
547func sizeUint32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
548 v := *p.Uint32()
549 if v == 0 {
550 return 0
551 }
552 return tagsize + wire.SizeVarint(uint64(v))
553}
554
555// appendUint32 wire encodes a uint32 pointer as a Uint32.
556// The zero value is not encoded.
557func appendUint32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
558 v := *p.Uint32()
559 if v == 0 {
560 return b, nil
561 }
562 b = wire.AppendVarint(b, wiretag)
563 b = wire.AppendVarint(b, uint64(v))
564 return b, nil
565}
566
567var coderUint32NoZero = pointerCoderFuncs{
568 size: sizeUint32NoZero,
569 marshal: appendUint32NoZero,
570}
571
572// sizeUint32Ptr returns the size of wire encoding a *uint32 pointer as a Uint32.
573// It panics if the pointer is nil.
574func sizeUint32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
575 v := **p.Uint32Ptr()
576 return tagsize + wire.SizeVarint(uint64(v))
577}
578
579// appendUint32 wire encodes a *uint32 pointer as a Uint32.
580// It panics if the pointer is nil.
581func appendUint32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
582 v := **p.Uint32Ptr()
583 b = wire.AppendVarint(b, wiretag)
584 b = wire.AppendVarint(b, uint64(v))
585 return b, nil
586}
587
588var coderUint32Ptr = pointerCoderFuncs{
589 size: sizeUint32Ptr,
590 marshal: appendUint32Ptr,
591}
592
593// sizeUint32Slice returns the size of wire encoding a []uint32 pointer as a repeated Uint32.
594func sizeUint32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
595 s := *p.Uint32Slice()
596 for _, v := range s {
597 size += tagsize + wire.SizeVarint(uint64(v))
598 }
599 return size
600}
601
602// appendUint32Slice encodes a []uint32 pointer as a repeated Uint32.
603func appendUint32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
604 s := *p.Uint32Slice()
605 for _, v := range s {
606 b = wire.AppendVarint(b, wiretag)
607 b = wire.AppendVarint(b, uint64(v))
608 }
609 return b, nil
610}
611
612var coderUint32Slice = pointerCoderFuncs{
613 size: sizeUint32Slice,
614 marshal: appendUint32Slice,
615}
616
617// sizeUint32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Uint32.
618func sizeUint32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
619 s := *p.Uint32Slice()
620 if len(s) == 0 {
621 return 0
622 }
623 n := 0
624 for _, v := range s {
625 n += wire.SizeVarint(uint64(v))
626 }
627 return tagsize + wire.SizeBytes(n)
628}
629
630// appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32.
631func appendUint32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
632 s := *p.Uint32Slice()
633 if len(s) == 0 {
634 return b, nil
635 }
636 b = wire.AppendVarint(b, wiretag)
637 n := 0
638 for _, v := range s {
639 n += wire.SizeVarint(uint64(v))
640 }
641 b = wire.AppendVarint(b, uint64(n))
642 for _, v := range s {
643 b = wire.AppendVarint(b, uint64(v))
644 }
645 return b, nil
646}
647
648var coderUint32PackedSlice = pointerCoderFuncs{
649 size: sizeUint32PackedSlice,
650 marshal: appendUint32PackedSlice,
651}
652
653// sizeUint32Iface returns the size of wire encoding a uint32 value as a Uint32.
654func sizeUint32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
655 v := ival.(uint32)
656 return tagsize + wire.SizeVarint(uint64(v))
657}
658
659// appendUint32Iface encodes a uint32 value as a Uint32.
660func appendUint32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
661 v := ival.(uint32)
662 b = wire.AppendVarint(b, wiretag)
663 b = wire.AppendVarint(b, uint64(v))
664 return b, nil
665}
666
667var coderUint32Iface = ifaceCoderFuncs{
668 size: sizeUint32Iface,
669 marshal: appendUint32Iface,
670}
671
672// sizeUint32SliceIface returns the size of wire encoding a []uint32 value as a repeated Uint32.
673func sizeUint32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
674 s := *ival.(*[]uint32)
675 for _, v := range s {
676 size += tagsize + wire.SizeVarint(uint64(v))
677 }
678 return size
679}
680
681// appendUint32SliceIface encodes a []uint32 value as a repeated Uint32.
682func appendUint32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
683 s := *ival.(*[]uint32)
684 for _, v := range s {
685 b = wire.AppendVarint(b, wiretag)
686 b = wire.AppendVarint(b, uint64(v))
687 }
688 return b, nil
689}
690
691var coderUint32SliceIface = ifaceCoderFuncs{
692 size: sizeUint32SliceIface,
693 marshal: appendUint32SliceIface,
694}
695
696// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.
697func sizeInt64(p pointer, tagsize int, _ marshalOptions) (size int) {
698 v := *p.Int64()
699 return tagsize + wire.SizeVarint(uint64(v))
700}
701
702// appendInt64 wire encodes a int64 pointer as a Int64.
703func appendInt64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
704 v := *p.Int64()
705 b = wire.AppendVarint(b, wiretag)
706 b = wire.AppendVarint(b, uint64(v))
707 return b, nil
708}
709
710var coderInt64 = pointerCoderFuncs{
711 size: sizeInt64,
712 marshal: appendInt64,
713}
714
715// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.
716// The zero value is not encoded.
717func sizeInt64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
718 v := *p.Int64()
719 if v == 0 {
720 return 0
721 }
722 return tagsize + wire.SizeVarint(uint64(v))
723}
724
725// appendInt64 wire encodes a int64 pointer as a Int64.
726// The zero value is not encoded.
727func appendInt64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
728 v := *p.Int64()
729 if v == 0 {
730 return b, nil
731 }
732 b = wire.AppendVarint(b, wiretag)
733 b = wire.AppendVarint(b, uint64(v))
734 return b, nil
735}
736
737var coderInt64NoZero = pointerCoderFuncs{
738 size: sizeInt64NoZero,
739 marshal: appendInt64NoZero,
740}
741
742// sizeInt64Ptr returns the size of wire encoding a *int64 pointer as a Int64.
743// It panics if the pointer is nil.
744func sizeInt64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
745 v := **p.Int64Ptr()
746 return tagsize + wire.SizeVarint(uint64(v))
747}
748
749// appendInt64 wire encodes a *int64 pointer as a Int64.
750// It panics if the pointer is nil.
751func appendInt64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
752 v := **p.Int64Ptr()
753 b = wire.AppendVarint(b, wiretag)
754 b = wire.AppendVarint(b, uint64(v))
755 return b, nil
756}
757
758var coderInt64Ptr = pointerCoderFuncs{
759 size: sizeInt64Ptr,
760 marshal: appendInt64Ptr,
761}
762
763// sizeInt64Slice returns the size of wire encoding a []int64 pointer as a repeated Int64.
764func sizeInt64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
765 s := *p.Int64Slice()
766 for _, v := range s {
767 size += tagsize + wire.SizeVarint(uint64(v))
768 }
769 return size
770}
771
772// appendInt64Slice encodes a []int64 pointer as a repeated Int64.
773func appendInt64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
774 s := *p.Int64Slice()
775 for _, v := range s {
776 b = wire.AppendVarint(b, wiretag)
777 b = wire.AppendVarint(b, uint64(v))
778 }
779 return b, nil
780}
781
782var coderInt64Slice = pointerCoderFuncs{
783 size: sizeInt64Slice,
784 marshal: appendInt64Slice,
785}
786
787// sizeInt64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Int64.
788func sizeInt64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
789 s := *p.Int64Slice()
790 if len(s) == 0 {
791 return 0
792 }
793 n := 0
794 for _, v := range s {
795 n += wire.SizeVarint(uint64(v))
796 }
797 return tagsize + wire.SizeBytes(n)
798}
799
800// appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64.
801func appendInt64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
802 s := *p.Int64Slice()
803 if len(s) == 0 {
804 return b, nil
805 }
806 b = wire.AppendVarint(b, wiretag)
807 n := 0
808 for _, v := range s {
809 n += wire.SizeVarint(uint64(v))
810 }
811 b = wire.AppendVarint(b, uint64(n))
812 for _, v := range s {
813 b = wire.AppendVarint(b, uint64(v))
814 }
815 return b, nil
816}
817
818var coderInt64PackedSlice = pointerCoderFuncs{
819 size: sizeInt64PackedSlice,
820 marshal: appendInt64PackedSlice,
821}
822
823// sizeInt64Iface returns the size of wire encoding a int64 value as a Int64.
824func sizeInt64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
825 v := ival.(int64)
826 return tagsize + wire.SizeVarint(uint64(v))
827}
828
829// appendInt64Iface encodes a int64 value as a Int64.
830func appendInt64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
831 v := ival.(int64)
832 b = wire.AppendVarint(b, wiretag)
833 b = wire.AppendVarint(b, uint64(v))
834 return b, nil
835}
836
837var coderInt64Iface = ifaceCoderFuncs{
838 size: sizeInt64Iface,
839 marshal: appendInt64Iface,
840}
841
842// sizeInt64SliceIface returns the size of wire encoding a []int64 value as a repeated Int64.
843func sizeInt64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
844 s := *ival.(*[]int64)
845 for _, v := range s {
846 size += tagsize + wire.SizeVarint(uint64(v))
847 }
848 return size
849}
850
851// appendInt64SliceIface encodes a []int64 value as a repeated Int64.
852func appendInt64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
853 s := *ival.(*[]int64)
854 for _, v := range s {
855 b = wire.AppendVarint(b, wiretag)
856 b = wire.AppendVarint(b, uint64(v))
857 }
858 return b, nil
859}
860
861var coderInt64SliceIface = ifaceCoderFuncs{
862 size: sizeInt64SliceIface,
863 marshal: appendInt64SliceIface,
864}
865
866// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.
867func sizeSint64(p pointer, tagsize int, _ marshalOptions) (size int) {
868 v := *p.Int64()
869 return tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
870}
871
872// appendSint64 wire encodes a int64 pointer as a Sint64.
873func appendSint64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
874 v := *p.Int64()
875 b = wire.AppendVarint(b, wiretag)
876 b = wire.AppendVarint(b, wire.EncodeZigZag(v))
877 return b, nil
878}
879
880var coderSint64 = pointerCoderFuncs{
881 size: sizeSint64,
882 marshal: appendSint64,
883}
884
885// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.
886// The zero value is not encoded.
887func sizeSint64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
888 v := *p.Int64()
889 if v == 0 {
890 return 0
891 }
892 return tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
893}
894
895// appendSint64 wire encodes a int64 pointer as a Sint64.
896// The zero value is not encoded.
897func appendSint64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
898 v := *p.Int64()
899 if v == 0 {
900 return b, nil
901 }
902 b = wire.AppendVarint(b, wiretag)
903 b = wire.AppendVarint(b, wire.EncodeZigZag(v))
904 return b, nil
905}
906
907var coderSint64NoZero = pointerCoderFuncs{
908 size: sizeSint64NoZero,
909 marshal: appendSint64NoZero,
910}
911
912// sizeSint64Ptr returns the size of wire encoding a *int64 pointer as a Sint64.
913// It panics if the pointer is nil.
914func sizeSint64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
915 v := **p.Int64Ptr()
916 return tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
917}
918
919// appendSint64 wire encodes a *int64 pointer as a Sint64.
920// It panics if the pointer is nil.
921func appendSint64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
922 v := **p.Int64Ptr()
923 b = wire.AppendVarint(b, wiretag)
924 b = wire.AppendVarint(b, wire.EncodeZigZag(v))
925 return b, nil
926}
927
928var coderSint64Ptr = pointerCoderFuncs{
929 size: sizeSint64Ptr,
930 marshal: appendSint64Ptr,
931}
932
933// sizeSint64Slice returns the size of wire encoding a []int64 pointer as a repeated Sint64.
934func sizeSint64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
935 s := *p.Int64Slice()
936 for _, v := range s {
937 size += tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
938 }
939 return size
940}
941
942// appendSint64Slice encodes a []int64 pointer as a repeated Sint64.
943func appendSint64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
944 s := *p.Int64Slice()
945 for _, v := range s {
946 b = wire.AppendVarint(b, wiretag)
947 b = wire.AppendVarint(b, wire.EncodeZigZag(v))
948 }
949 return b, nil
950}
951
952var coderSint64Slice = pointerCoderFuncs{
953 size: sizeSint64Slice,
954 marshal: appendSint64Slice,
955}
956
957// sizeSint64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sint64.
958func sizeSint64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
959 s := *p.Int64Slice()
960 if len(s) == 0 {
961 return 0
962 }
963 n := 0
964 for _, v := range s {
965 n += wire.SizeVarint(wire.EncodeZigZag(v))
966 }
967 return tagsize + wire.SizeBytes(n)
968}
969
970// appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64.
971func appendSint64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
972 s := *p.Int64Slice()
973 if len(s) == 0 {
974 return b, nil
975 }
976 b = wire.AppendVarint(b, wiretag)
977 n := 0
978 for _, v := range s {
979 n += wire.SizeVarint(wire.EncodeZigZag(v))
980 }
981 b = wire.AppendVarint(b, uint64(n))
982 for _, v := range s {
983 b = wire.AppendVarint(b, wire.EncodeZigZag(v))
984 }
985 return b, nil
986}
987
988var coderSint64PackedSlice = pointerCoderFuncs{
989 size: sizeSint64PackedSlice,
990 marshal: appendSint64PackedSlice,
991}
992
993// sizeSint64Iface returns the size of wire encoding a int64 value as a Sint64.
994func sizeSint64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
995 v := ival.(int64)
996 return tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
997}
998
999// appendSint64Iface encodes a int64 value as a Sint64.
1000func appendSint64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1001 v := ival.(int64)
1002 b = wire.AppendVarint(b, wiretag)
1003 b = wire.AppendVarint(b, wire.EncodeZigZag(v))
1004 return b, nil
1005}
1006
1007var coderSint64Iface = ifaceCoderFuncs{
1008 size: sizeSint64Iface,
1009 marshal: appendSint64Iface,
1010}
1011
1012// sizeSint64SliceIface returns the size of wire encoding a []int64 value as a repeated Sint64.
1013func sizeSint64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
1014 s := *ival.(*[]int64)
1015 for _, v := range s {
1016 size += tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
1017 }
1018 return size
1019}
1020
1021// appendSint64SliceIface encodes a []int64 value as a repeated Sint64.
1022func appendSint64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1023 s := *ival.(*[]int64)
1024 for _, v := range s {
1025 b = wire.AppendVarint(b, wiretag)
1026 b = wire.AppendVarint(b, wire.EncodeZigZag(v))
1027 }
1028 return b, nil
1029}
1030
1031var coderSint64SliceIface = ifaceCoderFuncs{
1032 size: sizeSint64SliceIface,
1033 marshal: appendSint64SliceIface,
1034}
1035
1036// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.
1037func sizeUint64(p pointer, tagsize int, _ marshalOptions) (size int) {
1038 v := *p.Uint64()
1039 return tagsize + wire.SizeVarint(v)
1040}
1041
1042// appendUint64 wire encodes a uint64 pointer as a Uint64.
1043func appendUint64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1044 v := *p.Uint64()
1045 b = wire.AppendVarint(b, wiretag)
1046 b = wire.AppendVarint(b, v)
1047 return b, nil
1048}
1049
1050var coderUint64 = pointerCoderFuncs{
1051 size: sizeUint64,
1052 marshal: appendUint64,
1053}
1054
1055// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.
1056// The zero value is not encoded.
1057func sizeUint64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
1058 v := *p.Uint64()
1059 if v == 0 {
1060 return 0
1061 }
1062 return tagsize + wire.SizeVarint(v)
1063}
1064
1065// appendUint64 wire encodes a uint64 pointer as a Uint64.
1066// The zero value is not encoded.
1067func appendUint64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1068 v := *p.Uint64()
1069 if v == 0 {
1070 return b, nil
1071 }
1072 b = wire.AppendVarint(b, wiretag)
1073 b = wire.AppendVarint(b, v)
1074 return b, nil
1075}
1076
1077var coderUint64NoZero = pointerCoderFuncs{
1078 size: sizeUint64NoZero,
1079 marshal: appendUint64NoZero,
1080}
1081
1082// sizeUint64Ptr returns the size of wire encoding a *uint64 pointer as a Uint64.
1083// It panics if the pointer is nil.
1084func sizeUint64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
1085 v := **p.Uint64Ptr()
1086 return tagsize + wire.SizeVarint(v)
1087}
1088
1089// appendUint64 wire encodes a *uint64 pointer as a Uint64.
1090// It panics if the pointer is nil.
1091func appendUint64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1092 v := **p.Uint64Ptr()
1093 b = wire.AppendVarint(b, wiretag)
1094 b = wire.AppendVarint(b, v)
1095 return b, nil
1096}
1097
1098var coderUint64Ptr = pointerCoderFuncs{
1099 size: sizeUint64Ptr,
1100 marshal: appendUint64Ptr,
1101}
1102
1103// sizeUint64Slice returns the size of wire encoding a []uint64 pointer as a repeated Uint64.
1104func sizeUint64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
1105 s := *p.Uint64Slice()
1106 for _, v := range s {
1107 size += tagsize + wire.SizeVarint(v)
1108 }
1109 return size
1110}
1111
1112// appendUint64Slice encodes a []uint64 pointer as a repeated Uint64.
1113func appendUint64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1114 s := *p.Uint64Slice()
1115 for _, v := range s {
1116 b = wire.AppendVarint(b, wiretag)
1117 b = wire.AppendVarint(b, v)
1118 }
1119 return b, nil
1120}
1121
1122var coderUint64Slice = pointerCoderFuncs{
1123 size: sizeUint64Slice,
1124 marshal: appendUint64Slice,
1125}
1126
1127// sizeUint64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Uint64.
1128func sizeUint64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
1129 s := *p.Uint64Slice()
1130 if len(s) == 0 {
1131 return 0
1132 }
1133 n := 0
1134 for _, v := range s {
1135 n += wire.SizeVarint(v)
1136 }
1137 return tagsize + wire.SizeBytes(n)
1138}
1139
1140// appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64.
1141func appendUint64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1142 s := *p.Uint64Slice()
1143 if len(s) == 0 {
1144 return b, nil
1145 }
1146 b = wire.AppendVarint(b, wiretag)
1147 n := 0
1148 for _, v := range s {
1149 n += wire.SizeVarint(v)
1150 }
1151 b = wire.AppendVarint(b, uint64(n))
1152 for _, v := range s {
1153 b = wire.AppendVarint(b, v)
1154 }
1155 return b, nil
1156}
1157
1158var coderUint64PackedSlice = pointerCoderFuncs{
1159 size: sizeUint64PackedSlice,
1160 marshal: appendUint64PackedSlice,
1161}
1162
1163// sizeUint64Iface returns the size of wire encoding a uint64 value as a Uint64.
1164func sizeUint64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
1165 v := ival.(uint64)
1166 return tagsize + wire.SizeVarint(v)
1167}
1168
1169// appendUint64Iface encodes a uint64 value as a Uint64.
1170func appendUint64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1171 v := ival.(uint64)
1172 b = wire.AppendVarint(b, wiretag)
1173 b = wire.AppendVarint(b, v)
1174 return b, nil
1175}
1176
1177var coderUint64Iface = ifaceCoderFuncs{
1178 size: sizeUint64Iface,
1179 marshal: appendUint64Iface,
1180}
1181
1182// sizeUint64SliceIface returns the size of wire encoding a []uint64 value as a repeated Uint64.
1183func sizeUint64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
1184 s := *ival.(*[]uint64)
1185 for _, v := range s {
1186 size += tagsize + wire.SizeVarint(v)
1187 }
1188 return size
1189}
1190
1191// appendUint64SliceIface encodes a []uint64 value as a repeated Uint64.
1192func appendUint64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1193 s := *ival.(*[]uint64)
1194 for _, v := range s {
1195 b = wire.AppendVarint(b, wiretag)
1196 b = wire.AppendVarint(b, v)
1197 }
1198 return b, nil
1199}
1200
1201var coderUint64SliceIface = ifaceCoderFuncs{
1202 size: sizeUint64SliceIface,
1203 marshal: appendUint64SliceIface,
1204}
1205
1206// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.
1207func sizeSfixed32(p pointer, tagsize int, _ marshalOptions) (size int) {
1208
1209 return tagsize + wire.SizeFixed32()
1210}
1211
1212// appendSfixed32 wire encodes a int32 pointer as a Sfixed32.
1213func appendSfixed32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1214 v := *p.Int32()
1215 b = wire.AppendVarint(b, wiretag)
1216 b = wire.AppendFixed32(b, uint32(v))
1217 return b, nil
1218}
1219
1220var coderSfixed32 = pointerCoderFuncs{
1221 size: sizeSfixed32,
1222 marshal: appendSfixed32,
1223}
1224
1225// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.
1226// The zero value is not encoded.
1227func sizeSfixed32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
1228 v := *p.Int32()
1229 if v == 0 {
1230 return 0
1231 }
1232 return tagsize + wire.SizeFixed32()
1233}
1234
1235// appendSfixed32 wire encodes a int32 pointer as a Sfixed32.
1236// The zero value is not encoded.
1237func appendSfixed32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1238 v := *p.Int32()
1239 if v == 0 {
1240 return b, nil
1241 }
1242 b = wire.AppendVarint(b, wiretag)
1243 b = wire.AppendFixed32(b, uint32(v))
1244 return b, nil
1245}
1246
1247var coderSfixed32NoZero = pointerCoderFuncs{
1248 size: sizeSfixed32NoZero,
1249 marshal: appendSfixed32NoZero,
1250}
1251
1252// sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32.
1253// It panics if the pointer is nil.
1254func sizeSfixed32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
1255 return tagsize + wire.SizeFixed32()
1256}
1257
1258// appendSfixed32 wire encodes a *int32 pointer as a Sfixed32.
1259// It panics if the pointer is nil.
1260func appendSfixed32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1261 v := **p.Int32Ptr()
1262 b = wire.AppendVarint(b, wiretag)
1263 b = wire.AppendFixed32(b, uint32(v))
1264 return b, nil
1265}
1266
1267var coderSfixed32Ptr = pointerCoderFuncs{
1268 size: sizeSfixed32Ptr,
1269 marshal: appendSfixed32Ptr,
1270}
1271
1272// sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32.
1273func sizeSfixed32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
1274 s := *p.Int32Slice()
1275 size = len(s) * (tagsize + wire.SizeFixed32())
1276 return size
1277}
1278
1279// appendSfixed32Slice encodes a []int32 pointer as a repeated Sfixed32.
1280func appendSfixed32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1281 s := *p.Int32Slice()
1282 for _, v := range s {
1283 b = wire.AppendVarint(b, wiretag)
1284 b = wire.AppendFixed32(b, uint32(v))
1285 }
1286 return b, nil
1287}
1288
1289var coderSfixed32Slice = pointerCoderFuncs{
1290 size: sizeSfixed32Slice,
1291 marshal: appendSfixed32Slice,
1292}
1293
1294// sizeSfixed32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sfixed32.
1295func sizeSfixed32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
1296 s := *p.Int32Slice()
1297 if len(s) == 0 {
1298 return 0
1299 }
1300 n := len(s) * wire.SizeFixed32()
1301 return tagsize + wire.SizeBytes(n)
1302}
1303
1304// appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32.
1305func appendSfixed32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1306 s := *p.Int32Slice()
1307 if len(s) == 0 {
1308 return b, nil
1309 }
1310 b = wire.AppendVarint(b, wiretag)
1311 n := len(s) * wire.SizeFixed32()
1312 b = wire.AppendVarint(b, uint64(n))
1313 for _, v := range s {
1314 b = wire.AppendFixed32(b, uint32(v))
1315 }
1316 return b, nil
1317}
1318
1319var coderSfixed32PackedSlice = pointerCoderFuncs{
1320 size: sizeSfixed32PackedSlice,
1321 marshal: appendSfixed32PackedSlice,
1322}
1323
1324// sizeSfixed32Iface returns the size of wire encoding a int32 value as a Sfixed32.
1325func sizeSfixed32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
1326 return tagsize + wire.SizeFixed32()
1327}
1328
1329// appendSfixed32Iface encodes a int32 value as a Sfixed32.
1330func appendSfixed32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1331 v := ival.(int32)
1332 b = wire.AppendVarint(b, wiretag)
1333 b = wire.AppendFixed32(b, uint32(v))
1334 return b, nil
1335}
1336
1337var coderSfixed32Iface = ifaceCoderFuncs{
1338 size: sizeSfixed32Iface,
1339 marshal: appendSfixed32Iface,
1340}
1341
1342// sizeSfixed32SliceIface returns the size of wire encoding a []int32 value as a repeated Sfixed32.
1343func sizeSfixed32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
1344 s := *ival.(*[]int32)
1345 size = len(s) * (tagsize + wire.SizeFixed32())
1346 return size
1347}
1348
1349// appendSfixed32SliceIface encodes a []int32 value as a repeated Sfixed32.
1350func appendSfixed32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1351 s := *ival.(*[]int32)
1352 for _, v := range s {
1353 b = wire.AppendVarint(b, wiretag)
1354 b = wire.AppendFixed32(b, uint32(v))
1355 }
1356 return b, nil
1357}
1358
1359var coderSfixed32SliceIface = ifaceCoderFuncs{
1360 size: sizeSfixed32SliceIface,
1361 marshal: appendSfixed32SliceIface,
1362}
1363
1364// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.
1365func sizeFixed32(p pointer, tagsize int, _ marshalOptions) (size int) {
1366
1367 return tagsize + wire.SizeFixed32()
1368}
1369
1370// appendFixed32 wire encodes a uint32 pointer as a Fixed32.
1371func appendFixed32(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1372 v := *p.Uint32()
1373 b = wire.AppendVarint(b, wiretag)
1374 b = wire.AppendFixed32(b, v)
1375 return b, nil
1376}
1377
1378var coderFixed32 = pointerCoderFuncs{
1379 size: sizeFixed32,
1380 marshal: appendFixed32,
1381}
1382
1383// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.
1384// The zero value is not encoded.
1385func sizeFixed32NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
1386 v := *p.Uint32()
1387 if v == 0 {
1388 return 0
1389 }
1390 return tagsize + wire.SizeFixed32()
1391}
1392
1393// appendFixed32 wire encodes a uint32 pointer as a Fixed32.
1394// The zero value is not encoded.
1395func appendFixed32NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1396 v := *p.Uint32()
1397 if v == 0 {
1398 return b, nil
1399 }
1400 b = wire.AppendVarint(b, wiretag)
1401 b = wire.AppendFixed32(b, v)
1402 return b, nil
1403}
1404
1405var coderFixed32NoZero = pointerCoderFuncs{
1406 size: sizeFixed32NoZero,
1407 marshal: appendFixed32NoZero,
1408}
1409
1410// sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32.
1411// It panics if the pointer is nil.
1412func sizeFixed32Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
1413 return tagsize + wire.SizeFixed32()
1414}
1415
1416// appendFixed32 wire encodes a *uint32 pointer as a Fixed32.
1417// It panics if the pointer is nil.
1418func appendFixed32Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1419 v := **p.Uint32Ptr()
1420 b = wire.AppendVarint(b, wiretag)
1421 b = wire.AppendFixed32(b, v)
1422 return b, nil
1423}
1424
1425var coderFixed32Ptr = pointerCoderFuncs{
1426 size: sizeFixed32Ptr,
1427 marshal: appendFixed32Ptr,
1428}
1429
1430// sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32.
1431func sizeFixed32Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
1432 s := *p.Uint32Slice()
1433 size = len(s) * (tagsize + wire.SizeFixed32())
1434 return size
1435}
1436
1437// appendFixed32Slice encodes a []uint32 pointer as a repeated Fixed32.
1438func appendFixed32Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1439 s := *p.Uint32Slice()
1440 for _, v := range s {
1441 b = wire.AppendVarint(b, wiretag)
1442 b = wire.AppendFixed32(b, v)
1443 }
1444 return b, nil
1445}
1446
1447var coderFixed32Slice = pointerCoderFuncs{
1448 size: sizeFixed32Slice,
1449 marshal: appendFixed32Slice,
1450}
1451
1452// sizeFixed32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Fixed32.
1453func sizeFixed32PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
1454 s := *p.Uint32Slice()
1455 if len(s) == 0 {
1456 return 0
1457 }
1458 n := len(s) * wire.SizeFixed32()
1459 return tagsize + wire.SizeBytes(n)
1460}
1461
1462// appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32.
1463func appendFixed32PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1464 s := *p.Uint32Slice()
1465 if len(s) == 0 {
1466 return b, nil
1467 }
1468 b = wire.AppendVarint(b, wiretag)
1469 n := len(s) * wire.SizeFixed32()
1470 b = wire.AppendVarint(b, uint64(n))
1471 for _, v := range s {
1472 b = wire.AppendFixed32(b, v)
1473 }
1474 return b, nil
1475}
1476
1477var coderFixed32PackedSlice = pointerCoderFuncs{
1478 size: sizeFixed32PackedSlice,
1479 marshal: appendFixed32PackedSlice,
1480}
1481
1482// sizeFixed32Iface returns the size of wire encoding a uint32 value as a Fixed32.
1483func sizeFixed32Iface(ival interface{}, tagsize int, _ marshalOptions) int {
1484 return tagsize + wire.SizeFixed32()
1485}
1486
1487// appendFixed32Iface encodes a uint32 value as a Fixed32.
1488func appendFixed32Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1489 v := ival.(uint32)
1490 b = wire.AppendVarint(b, wiretag)
1491 b = wire.AppendFixed32(b, v)
1492 return b, nil
1493}
1494
1495var coderFixed32Iface = ifaceCoderFuncs{
1496 size: sizeFixed32Iface,
1497 marshal: appendFixed32Iface,
1498}
1499
1500// sizeFixed32SliceIface returns the size of wire encoding a []uint32 value as a repeated Fixed32.
1501func sizeFixed32SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
1502 s := *ival.(*[]uint32)
1503 size = len(s) * (tagsize + wire.SizeFixed32())
1504 return size
1505}
1506
1507// appendFixed32SliceIface encodes a []uint32 value as a repeated Fixed32.
1508func appendFixed32SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1509 s := *ival.(*[]uint32)
1510 for _, v := range s {
1511 b = wire.AppendVarint(b, wiretag)
1512 b = wire.AppendFixed32(b, v)
1513 }
1514 return b, nil
1515}
1516
1517var coderFixed32SliceIface = ifaceCoderFuncs{
1518 size: sizeFixed32SliceIface,
1519 marshal: appendFixed32SliceIface,
1520}
1521
1522// sizeFloat returns the size of wire encoding a float32 pointer as a Float.
1523func sizeFloat(p pointer, tagsize int, _ marshalOptions) (size int) {
1524
1525 return tagsize + wire.SizeFixed32()
1526}
1527
1528// appendFloat wire encodes a float32 pointer as a Float.
1529func appendFloat(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1530 v := *p.Float32()
1531 b = wire.AppendVarint(b, wiretag)
1532 b = wire.AppendFixed32(b, math.Float32bits(v))
1533 return b, nil
1534}
1535
1536var coderFloat = pointerCoderFuncs{
1537 size: sizeFloat,
1538 marshal: appendFloat,
1539}
1540
1541// sizeFloat returns the size of wire encoding a float32 pointer as a Float.
1542// The zero value is not encoded.
1543func sizeFloatNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
1544 v := *p.Float32()
1545 if v == 0 && !math.Signbit(float64(v)) {
1546 return 0
1547 }
1548 return tagsize + wire.SizeFixed32()
1549}
1550
1551// appendFloat wire encodes a float32 pointer as a Float.
1552// The zero value is not encoded.
1553func appendFloatNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1554 v := *p.Float32()
1555 if v == 0 && !math.Signbit(float64(v)) {
1556 return b, nil
1557 }
1558 b = wire.AppendVarint(b, wiretag)
1559 b = wire.AppendFixed32(b, math.Float32bits(v))
1560 return b, nil
1561}
1562
1563var coderFloatNoZero = pointerCoderFuncs{
1564 size: sizeFloatNoZero,
1565 marshal: appendFloatNoZero,
1566}
1567
1568// sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float.
1569// It panics if the pointer is nil.
1570func sizeFloatPtr(p pointer, tagsize int, _ marshalOptions) (size int) {
1571 return tagsize + wire.SizeFixed32()
1572}
1573
1574// appendFloat wire encodes a *float32 pointer as a Float.
1575// It panics if the pointer is nil.
1576func appendFloatPtr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1577 v := **p.Float32Ptr()
1578 b = wire.AppendVarint(b, wiretag)
1579 b = wire.AppendFixed32(b, math.Float32bits(v))
1580 return b, nil
1581}
1582
1583var coderFloatPtr = pointerCoderFuncs{
1584 size: sizeFloatPtr,
1585 marshal: appendFloatPtr,
1586}
1587
1588// sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float.
1589func sizeFloatSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
1590 s := *p.Float32Slice()
1591 size = len(s) * (tagsize + wire.SizeFixed32())
1592 return size
1593}
1594
1595// appendFloatSlice encodes a []float32 pointer as a repeated Float.
1596func appendFloatSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1597 s := *p.Float32Slice()
1598 for _, v := range s {
1599 b = wire.AppendVarint(b, wiretag)
1600 b = wire.AppendFixed32(b, math.Float32bits(v))
1601 }
1602 return b, nil
1603}
1604
1605var coderFloatSlice = pointerCoderFuncs{
1606 size: sizeFloatSlice,
1607 marshal: appendFloatSlice,
1608}
1609
1610// sizeFloatPackedSlice returns the size of wire encoding a []float32 pointer as a packed repeated Float.
1611func sizeFloatPackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
1612 s := *p.Float32Slice()
1613 if len(s) == 0 {
1614 return 0
1615 }
1616 n := len(s) * wire.SizeFixed32()
1617 return tagsize + wire.SizeBytes(n)
1618}
1619
1620// appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float.
1621func appendFloatPackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1622 s := *p.Float32Slice()
1623 if len(s) == 0 {
1624 return b, nil
1625 }
1626 b = wire.AppendVarint(b, wiretag)
1627 n := len(s) * wire.SizeFixed32()
1628 b = wire.AppendVarint(b, uint64(n))
1629 for _, v := range s {
1630 b = wire.AppendFixed32(b, math.Float32bits(v))
1631 }
1632 return b, nil
1633}
1634
1635var coderFloatPackedSlice = pointerCoderFuncs{
1636 size: sizeFloatPackedSlice,
1637 marshal: appendFloatPackedSlice,
1638}
1639
1640// sizeFloatIface returns the size of wire encoding a float32 value as a Float.
1641func sizeFloatIface(ival interface{}, tagsize int, _ marshalOptions) int {
1642 return tagsize + wire.SizeFixed32()
1643}
1644
1645// appendFloatIface encodes a float32 value as a Float.
1646func appendFloatIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1647 v := ival.(float32)
1648 b = wire.AppendVarint(b, wiretag)
1649 b = wire.AppendFixed32(b, math.Float32bits(v))
1650 return b, nil
1651}
1652
1653var coderFloatIface = ifaceCoderFuncs{
1654 size: sizeFloatIface,
1655 marshal: appendFloatIface,
1656}
1657
1658// sizeFloatSliceIface returns the size of wire encoding a []float32 value as a repeated Float.
1659func sizeFloatSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
1660 s := *ival.(*[]float32)
1661 size = len(s) * (tagsize + wire.SizeFixed32())
1662 return size
1663}
1664
1665// appendFloatSliceIface encodes a []float32 value as a repeated Float.
1666func appendFloatSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1667 s := *ival.(*[]float32)
1668 for _, v := range s {
1669 b = wire.AppendVarint(b, wiretag)
1670 b = wire.AppendFixed32(b, math.Float32bits(v))
1671 }
1672 return b, nil
1673}
1674
1675var coderFloatSliceIface = ifaceCoderFuncs{
1676 size: sizeFloatSliceIface,
1677 marshal: appendFloatSliceIface,
1678}
1679
1680// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.
1681func sizeSfixed64(p pointer, tagsize int, _ marshalOptions) (size int) {
1682
1683 return tagsize + wire.SizeFixed64()
1684}
1685
1686// appendSfixed64 wire encodes a int64 pointer as a Sfixed64.
1687func appendSfixed64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1688 v := *p.Int64()
1689 b = wire.AppendVarint(b, wiretag)
1690 b = wire.AppendFixed64(b, uint64(v))
1691 return b, nil
1692}
1693
1694var coderSfixed64 = pointerCoderFuncs{
1695 size: sizeSfixed64,
1696 marshal: appendSfixed64,
1697}
1698
1699// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.
1700// The zero value is not encoded.
1701func sizeSfixed64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
1702 v := *p.Int64()
1703 if v == 0 {
1704 return 0
1705 }
1706 return tagsize + wire.SizeFixed64()
1707}
1708
1709// appendSfixed64 wire encodes a int64 pointer as a Sfixed64.
1710// The zero value is not encoded.
1711func appendSfixed64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1712 v := *p.Int64()
1713 if v == 0 {
1714 return b, nil
1715 }
1716 b = wire.AppendVarint(b, wiretag)
1717 b = wire.AppendFixed64(b, uint64(v))
1718 return b, nil
1719}
1720
1721var coderSfixed64NoZero = pointerCoderFuncs{
1722 size: sizeSfixed64NoZero,
1723 marshal: appendSfixed64NoZero,
1724}
1725
1726// sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64.
1727// It panics if the pointer is nil.
1728func sizeSfixed64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
1729 return tagsize + wire.SizeFixed64()
1730}
1731
1732// appendSfixed64 wire encodes a *int64 pointer as a Sfixed64.
1733// It panics if the pointer is nil.
1734func appendSfixed64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1735 v := **p.Int64Ptr()
1736 b = wire.AppendVarint(b, wiretag)
1737 b = wire.AppendFixed64(b, uint64(v))
1738 return b, nil
1739}
1740
1741var coderSfixed64Ptr = pointerCoderFuncs{
1742 size: sizeSfixed64Ptr,
1743 marshal: appendSfixed64Ptr,
1744}
1745
1746// sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64.
1747func sizeSfixed64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
1748 s := *p.Int64Slice()
1749 size = len(s) * (tagsize + wire.SizeFixed64())
1750 return size
1751}
1752
1753// appendSfixed64Slice encodes a []int64 pointer as a repeated Sfixed64.
1754func appendSfixed64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1755 s := *p.Int64Slice()
1756 for _, v := range s {
1757 b = wire.AppendVarint(b, wiretag)
1758 b = wire.AppendFixed64(b, uint64(v))
1759 }
1760 return b, nil
1761}
1762
1763var coderSfixed64Slice = pointerCoderFuncs{
1764 size: sizeSfixed64Slice,
1765 marshal: appendSfixed64Slice,
1766}
1767
1768// sizeSfixed64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sfixed64.
1769func sizeSfixed64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
1770 s := *p.Int64Slice()
1771 if len(s) == 0 {
1772 return 0
1773 }
1774 n := len(s) * wire.SizeFixed64()
1775 return tagsize + wire.SizeBytes(n)
1776}
1777
1778// appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64.
1779func appendSfixed64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1780 s := *p.Int64Slice()
1781 if len(s) == 0 {
1782 return b, nil
1783 }
1784 b = wire.AppendVarint(b, wiretag)
1785 n := len(s) * wire.SizeFixed64()
1786 b = wire.AppendVarint(b, uint64(n))
1787 for _, v := range s {
1788 b = wire.AppendFixed64(b, uint64(v))
1789 }
1790 return b, nil
1791}
1792
1793var coderSfixed64PackedSlice = pointerCoderFuncs{
1794 size: sizeSfixed64PackedSlice,
1795 marshal: appendSfixed64PackedSlice,
1796}
1797
1798// sizeSfixed64Iface returns the size of wire encoding a int64 value as a Sfixed64.
1799func sizeSfixed64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
1800 return tagsize + wire.SizeFixed64()
1801}
1802
1803// appendSfixed64Iface encodes a int64 value as a Sfixed64.
1804func appendSfixed64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1805 v := ival.(int64)
1806 b = wire.AppendVarint(b, wiretag)
1807 b = wire.AppendFixed64(b, uint64(v))
1808 return b, nil
1809}
1810
1811var coderSfixed64Iface = ifaceCoderFuncs{
1812 size: sizeSfixed64Iface,
1813 marshal: appendSfixed64Iface,
1814}
1815
1816// sizeSfixed64SliceIface returns the size of wire encoding a []int64 value as a repeated Sfixed64.
1817func sizeSfixed64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
1818 s := *ival.(*[]int64)
1819 size = len(s) * (tagsize + wire.SizeFixed64())
1820 return size
1821}
1822
1823// appendSfixed64SliceIface encodes a []int64 value as a repeated Sfixed64.
1824func appendSfixed64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1825 s := *ival.(*[]int64)
1826 for _, v := range s {
1827 b = wire.AppendVarint(b, wiretag)
1828 b = wire.AppendFixed64(b, uint64(v))
1829 }
1830 return b, nil
1831}
1832
1833var coderSfixed64SliceIface = ifaceCoderFuncs{
1834 size: sizeSfixed64SliceIface,
1835 marshal: appendSfixed64SliceIface,
1836}
1837
1838// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.
1839func sizeFixed64(p pointer, tagsize int, _ marshalOptions) (size int) {
1840
1841 return tagsize + wire.SizeFixed64()
1842}
1843
1844// appendFixed64 wire encodes a uint64 pointer as a Fixed64.
1845func appendFixed64(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1846 v := *p.Uint64()
1847 b = wire.AppendVarint(b, wiretag)
1848 b = wire.AppendFixed64(b, v)
1849 return b, nil
1850}
1851
1852var coderFixed64 = pointerCoderFuncs{
1853 size: sizeFixed64,
1854 marshal: appendFixed64,
1855}
1856
1857// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.
1858// The zero value is not encoded.
1859func sizeFixed64NoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
1860 v := *p.Uint64()
1861 if v == 0 {
1862 return 0
1863 }
1864 return tagsize + wire.SizeFixed64()
1865}
1866
1867// appendFixed64 wire encodes a uint64 pointer as a Fixed64.
1868// The zero value is not encoded.
1869func appendFixed64NoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1870 v := *p.Uint64()
1871 if v == 0 {
1872 return b, nil
1873 }
1874 b = wire.AppendVarint(b, wiretag)
1875 b = wire.AppendFixed64(b, v)
1876 return b, nil
1877}
1878
1879var coderFixed64NoZero = pointerCoderFuncs{
1880 size: sizeFixed64NoZero,
1881 marshal: appendFixed64NoZero,
1882}
1883
1884// sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64.
1885// It panics if the pointer is nil.
1886func sizeFixed64Ptr(p pointer, tagsize int, _ marshalOptions) (size int) {
1887 return tagsize + wire.SizeFixed64()
1888}
1889
1890// appendFixed64 wire encodes a *uint64 pointer as a Fixed64.
1891// It panics if the pointer is nil.
1892func appendFixed64Ptr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1893 v := **p.Uint64Ptr()
1894 b = wire.AppendVarint(b, wiretag)
1895 b = wire.AppendFixed64(b, v)
1896 return b, nil
1897}
1898
1899var coderFixed64Ptr = pointerCoderFuncs{
1900 size: sizeFixed64Ptr,
1901 marshal: appendFixed64Ptr,
1902}
1903
1904// sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64.
1905func sizeFixed64Slice(p pointer, tagsize int, _ marshalOptions) (size int) {
1906 s := *p.Uint64Slice()
1907 size = len(s) * (tagsize + wire.SizeFixed64())
1908 return size
1909}
1910
1911// appendFixed64Slice encodes a []uint64 pointer as a repeated Fixed64.
1912func appendFixed64Slice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1913 s := *p.Uint64Slice()
1914 for _, v := range s {
1915 b = wire.AppendVarint(b, wiretag)
1916 b = wire.AppendFixed64(b, v)
1917 }
1918 return b, nil
1919}
1920
1921var coderFixed64Slice = pointerCoderFuncs{
1922 size: sizeFixed64Slice,
1923 marshal: appendFixed64Slice,
1924}
1925
1926// sizeFixed64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Fixed64.
1927func sizeFixed64PackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
1928 s := *p.Uint64Slice()
1929 if len(s) == 0 {
1930 return 0
1931 }
1932 n := len(s) * wire.SizeFixed64()
1933 return tagsize + wire.SizeBytes(n)
1934}
1935
1936// appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64.
1937func appendFixed64PackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
1938 s := *p.Uint64Slice()
1939 if len(s) == 0 {
1940 return b, nil
1941 }
1942 b = wire.AppendVarint(b, wiretag)
1943 n := len(s) * wire.SizeFixed64()
1944 b = wire.AppendVarint(b, uint64(n))
1945 for _, v := range s {
1946 b = wire.AppendFixed64(b, v)
1947 }
1948 return b, nil
1949}
1950
1951var coderFixed64PackedSlice = pointerCoderFuncs{
1952 size: sizeFixed64PackedSlice,
1953 marshal: appendFixed64PackedSlice,
1954}
1955
1956// sizeFixed64Iface returns the size of wire encoding a uint64 value as a Fixed64.
1957func sizeFixed64Iface(ival interface{}, tagsize int, _ marshalOptions) int {
1958 return tagsize + wire.SizeFixed64()
1959}
1960
1961// appendFixed64Iface encodes a uint64 value as a Fixed64.
1962func appendFixed64Iface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1963 v := ival.(uint64)
1964 b = wire.AppendVarint(b, wiretag)
1965 b = wire.AppendFixed64(b, v)
1966 return b, nil
1967}
1968
1969var coderFixed64Iface = ifaceCoderFuncs{
1970 size: sizeFixed64Iface,
1971 marshal: appendFixed64Iface,
1972}
1973
1974// sizeFixed64SliceIface returns the size of wire encoding a []uint64 value as a repeated Fixed64.
1975func sizeFixed64SliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
1976 s := *ival.(*[]uint64)
1977 size = len(s) * (tagsize + wire.SizeFixed64())
1978 return size
1979}
1980
1981// appendFixed64SliceIface encodes a []uint64 value as a repeated Fixed64.
1982func appendFixed64SliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
1983 s := *ival.(*[]uint64)
1984 for _, v := range s {
1985 b = wire.AppendVarint(b, wiretag)
1986 b = wire.AppendFixed64(b, v)
1987 }
1988 return b, nil
1989}
1990
1991var coderFixed64SliceIface = ifaceCoderFuncs{
1992 size: sizeFixed64SliceIface,
1993 marshal: appendFixed64SliceIface,
1994}
1995
1996// sizeDouble returns the size of wire encoding a float64 pointer as a Double.
1997func sizeDouble(p pointer, tagsize int, _ marshalOptions) (size int) {
1998
1999 return tagsize + wire.SizeFixed64()
2000}
2001
2002// appendDouble wire encodes a float64 pointer as a Double.
2003func appendDouble(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2004 v := *p.Float64()
2005 b = wire.AppendVarint(b, wiretag)
2006 b = wire.AppendFixed64(b, math.Float64bits(v))
2007 return b, nil
2008}
2009
2010var coderDouble = pointerCoderFuncs{
2011 size: sizeDouble,
2012 marshal: appendDouble,
2013}
2014
2015// sizeDouble returns the size of wire encoding a float64 pointer as a Double.
2016// The zero value is not encoded.
2017func sizeDoubleNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
2018 v := *p.Float64()
2019 if v == 0 && !math.Signbit(float64(v)) {
2020 return 0
2021 }
2022 return tagsize + wire.SizeFixed64()
2023}
2024
2025// appendDouble wire encodes a float64 pointer as a Double.
2026// The zero value is not encoded.
2027func appendDoubleNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2028 v := *p.Float64()
2029 if v == 0 && !math.Signbit(float64(v)) {
2030 return b, nil
2031 }
2032 b = wire.AppendVarint(b, wiretag)
2033 b = wire.AppendFixed64(b, math.Float64bits(v))
2034 return b, nil
2035}
2036
2037var coderDoubleNoZero = pointerCoderFuncs{
2038 size: sizeDoubleNoZero,
2039 marshal: appendDoubleNoZero,
2040}
2041
2042// sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double.
2043// It panics if the pointer is nil.
2044func sizeDoublePtr(p pointer, tagsize int, _ marshalOptions) (size int) {
2045 return tagsize + wire.SizeFixed64()
2046}
2047
2048// appendDouble wire encodes a *float64 pointer as a Double.
2049// It panics if the pointer is nil.
2050func appendDoublePtr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2051 v := **p.Float64Ptr()
2052 b = wire.AppendVarint(b, wiretag)
2053 b = wire.AppendFixed64(b, math.Float64bits(v))
2054 return b, nil
2055}
2056
2057var coderDoublePtr = pointerCoderFuncs{
2058 size: sizeDoublePtr,
2059 marshal: appendDoublePtr,
2060}
2061
2062// sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double.
2063func sizeDoubleSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
2064 s := *p.Float64Slice()
2065 size = len(s) * (tagsize + wire.SizeFixed64())
2066 return size
2067}
2068
2069// appendDoubleSlice encodes a []float64 pointer as a repeated Double.
2070func appendDoubleSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2071 s := *p.Float64Slice()
2072 for _, v := range s {
2073 b = wire.AppendVarint(b, wiretag)
2074 b = wire.AppendFixed64(b, math.Float64bits(v))
2075 }
2076 return b, nil
2077}
2078
2079var coderDoubleSlice = pointerCoderFuncs{
2080 size: sizeDoubleSlice,
2081 marshal: appendDoubleSlice,
2082}
2083
2084// sizeDoublePackedSlice returns the size of wire encoding a []float64 pointer as a packed repeated Double.
2085func sizeDoublePackedSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
2086 s := *p.Float64Slice()
2087 if len(s) == 0 {
2088 return 0
2089 }
2090 n := len(s) * wire.SizeFixed64()
2091 return tagsize + wire.SizeBytes(n)
2092}
2093
2094// appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double.
2095func appendDoublePackedSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2096 s := *p.Float64Slice()
2097 if len(s) == 0 {
2098 return b, nil
2099 }
2100 b = wire.AppendVarint(b, wiretag)
2101 n := len(s) * wire.SizeFixed64()
2102 b = wire.AppendVarint(b, uint64(n))
2103 for _, v := range s {
2104 b = wire.AppendFixed64(b, math.Float64bits(v))
2105 }
2106 return b, nil
2107}
2108
2109var coderDoublePackedSlice = pointerCoderFuncs{
2110 size: sizeDoublePackedSlice,
2111 marshal: appendDoublePackedSlice,
2112}
2113
2114// sizeDoubleIface returns the size of wire encoding a float64 value as a Double.
2115func sizeDoubleIface(ival interface{}, tagsize int, _ marshalOptions) int {
2116 return tagsize + wire.SizeFixed64()
2117}
2118
2119// appendDoubleIface encodes a float64 value as a Double.
2120func appendDoubleIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
2121 v := ival.(float64)
2122 b = wire.AppendVarint(b, wiretag)
2123 b = wire.AppendFixed64(b, math.Float64bits(v))
2124 return b, nil
2125}
2126
2127var coderDoubleIface = ifaceCoderFuncs{
2128 size: sizeDoubleIface,
2129 marshal: appendDoubleIface,
2130}
2131
2132// sizeDoubleSliceIface returns the size of wire encoding a []float64 value as a repeated Double.
2133func sizeDoubleSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
2134 s := *ival.(*[]float64)
2135 size = len(s) * (tagsize + wire.SizeFixed64())
2136 return size
2137}
2138
2139// appendDoubleSliceIface encodes a []float64 value as a repeated Double.
2140func appendDoubleSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
2141 s := *ival.(*[]float64)
2142 for _, v := range s {
2143 b = wire.AppendVarint(b, wiretag)
2144 b = wire.AppendFixed64(b, math.Float64bits(v))
2145 }
2146 return b, nil
2147}
2148
2149var coderDoubleSliceIface = ifaceCoderFuncs{
2150 size: sizeDoubleSliceIface,
2151 marshal: appendDoubleSliceIface,
2152}
2153
2154// sizeString returns the size of wire encoding a string pointer as a String.
2155func sizeString(p pointer, tagsize int, _ marshalOptions) (size int) {
2156 v := *p.String()
2157 return tagsize + wire.SizeBytes(len([]byte(v)))
2158}
2159
2160// appendString wire encodes a string pointer as a String.
2161func appendString(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2162 v := *p.String()
2163 b = wire.AppendVarint(b, wiretag)
2164 b = wire.AppendBytes(b, []byte(v))
2165 return b, nil
2166}
2167
2168var coderString = pointerCoderFuncs{
2169 size: sizeString,
2170 marshal: appendString,
2171}
2172
2173// sizeString returns the size of wire encoding a string pointer as a String.
2174// The zero value is not encoded.
2175func sizeStringNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
2176 v := *p.String()
2177 if len(v) == 0 {
2178 return 0
2179 }
2180 return tagsize + wire.SizeBytes(len([]byte(v)))
2181}
2182
2183// appendString wire encodes a string pointer as a String.
2184// The zero value is not encoded.
2185func appendStringNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2186 v := *p.String()
2187 if len(v) == 0 {
2188 return b, nil
2189 }
2190 b = wire.AppendVarint(b, wiretag)
2191 b = wire.AppendBytes(b, []byte(v))
2192 return b, nil
2193}
2194
2195var coderStringNoZero = pointerCoderFuncs{
2196 size: sizeStringNoZero,
2197 marshal: appendStringNoZero,
2198}
2199
2200// sizeStringPtr returns the size of wire encoding a *string pointer as a String.
2201// It panics if the pointer is nil.
2202func sizeStringPtr(p pointer, tagsize int, _ marshalOptions) (size int) {
2203 v := **p.StringPtr()
2204 return tagsize + wire.SizeBytes(len([]byte(v)))
2205}
2206
2207// appendString wire encodes a *string pointer as a String.
2208// It panics if the pointer is nil.
2209func appendStringPtr(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2210 v := **p.StringPtr()
2211 b = wire.AppendVarint(b, wiretag)
2212 b = wire.AppendBytes(b, []byte(v))
2213 return b, nil
2214}
2215
2216var coderStringPtr = pointerCoderFuncs{
2217 size: sizeStringPtr,
2218 marshal: appendStringPtr,
2219}
2220
2221// sizeStringSlice returns the size of wire encoding a []string pointer as a repeated String.
2222func sizeStringSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
2223 s := *p.StringSlice()
2224 for _, v := range s {
2225 size += tagsize + wire.SizeBytes(len([]byte(v)))
2226 }
2227 return size
2228}
2229
2230// appendStringSlice encodes a []string pointer as a repeated String.
2231func appendStringSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2232 s := *p.StringSlice()
2233 for _, v := range s {
2234 b = wire.AppendVarint(b, wiretag)
2235 b = wire.AppendBytes(b, []byte(v))
2236 }
2237 return b, nil
2238}
2239
2240var coderStringSlice = pointerCoderFuncs{
2241 size: sizeStringSlice,
2242 marshal: appendStringSlice,
2243}
2244
2245// sizeStringIface returns the size of wire encoding a string value as a String.
2246func sizeStringIface(ival interface{}, tagsize int, _ marshalOptions) int {
2247 v := ival.(string)
2248 return tagsize + wire.SizeBytes(len([]byte(v)))
2249}
2250
2251// appendStringIface encodes a string value as a String.
2252func appendStringIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
2253 v := ival.(string)
2254 b = wire.AppendVarint(b, wiretag)
2255 b = wire.AppendBytes(b, []byte(v))
2256 return b, nil
2257}
2258
2259var coderStringIface = ifaceCoderFuncs{
2260 size: sizeStringIface,
2261 marshal: appendStringIface,
2262}
2263
2264// sizeStringSliceIface returns the size of wire encoding a []string value as a repeated String.
2265func sizeStringSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
2266 s := *ival.(*[]string)
2267 for _, v := range s {
2268 size += tagsize + wire.SizeBytes(len([]byte(v)))
2269 }
2270 return size
2271}
2272
2273// appendStringSliceIface encodes a []string value as a repeated String.
2274func appendStringSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
2275 s := *ival.(*[]string)
2276 for _, v := range s {
2277 b = wire.AppendVarint(b, wiretag)
2278 b = wire.AppendBytes(b, []byte(v))
2279 }
2280 return b, nil
2281}
2282
2283var coderStringSliceIface = ifaceCoderFuncs{
2284 size: sizeStringSliceIface,
2285 marshal: appendStringSliceIface,
2286}
2287
2288// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.
2289func sizeBytes(p pointer, tagsize int, _ marshalOptions) (size int) {
2290 v := *p.Bytes()
2291 return tagsize + wire.SizeBytes(len(v))
2292}
2293
2294// appendBytes wire encodes a []byte pointer as a Bytes.
2295func appendBytes(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2296 v := *p.Bytes()
2297 b = wire.AppendVarint(b, wiretag)
2298 b = wire.AppendBytes(b, v)
2299 return b, nil
2300}
2301
2302var coderBytes = pointerCoderFuncs{
2303 size: sizeBytes,
2304 marshal: appendBytes,
2305}
2306
2307// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.
2308// The zero value is not encoded.
2309func sizeBytesNoZero(p pointer, tagsize int, _ marshalOptions) (size int) {
2310 v := *p.Bytes()
2311 if len(v) == 0 {
2312 return 0
2313 }
2314 return tagsize + wire.SizeBytes(len(v))
2315}
2316
2317// appendBytes wire encodes a []byte pointer as a Bytes.
2318// The zero value is not encoded.
2319func appendBytesNoZero(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2320 v := *p.Bytes()
2321 if len(v) == 0 {
2322 return b, nil
2323 }
2324 b = wire.AppendVarint(b, wiretag)
2325 b = wire.AppendBytes(b, v)
2326 return b, nil
2327}
2328
2329var coderBytesNoZero = pointerCoderFuncs{
2330 size: sizeBytesNoZero,
2331 marshal: appendBytesNoZero,
2332}
2333
2334// sizeBytesSlice returns the size of wire encoding a [][]byte pointer as a repeated Bytes.
2335func sizeBytesSlice(p pointer, tagsize int, _ marshalOptions) (size int) {
2336 s := *p.BytesSlice()
2337 for _, v := range s {
2338 size += tagsize + wire.SizeBytes(len(v))
2339 }
2340 return size
2341}
2342
2343// appendBytesSlice encodes a [][]byte pointer as a repeated Bytes.
2344func appendBytesSlice(b []byte, p pointer, wiretag uint64, _ marshalOptions) ([]byte, error) {
2345 s := *p.BytesSlice()
2346 for _, v := range s {
2347 b = wire.AppendVarint(b, wiretag)
2348 b = wire.AppendBytes(b, v)
2349 }
2350 return b, nil
2351}
2352
2353var coderBytesSlice = pointerCoderFuncs{
2354 size: sizeBytesSlice,
2355 marshal: appendBytesSlice,
2356}
2357
2358// sizeBytesIface returns the size of wire encoding a []byte value as a Bytes.
2359func sizeBytesIface(ival interface{}, tagsize int, _ marshalOptions) int {
2360 v := ival.([]byte)
2361 return tagsize + wire.SizeBytes(len(v))
2362}
2363
2364// appendBytesIface encodes a []byte value as a Bytes.
2365func appendBytesIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
2366 v := ival.([]byte)
2367 b = wire.AppendVarint(b, wiretag)
2368 b = wire.AppendBytes(b, v)
2369 return b, nil
2370}
2371
2372var coderBytesIface = ifaceCoderFuncs{
2373 size: sizeBytesIface,
2374 marshal: appendBytesIface,
2375}
2376
2377// sizeBytesSliceIface returns the size of wire encoding a [][]byte value as a repeated Bytes.
2378func sizeBytesSliceIface(ival interface{}, tagsize int, _ marshalOptions) (size int) {
2379 s := *ival.(*[][]byte)
2380 for _, v := range s {
2381 size += tagsize + wire.SizeBytes(len(v))
2382 }
2383 return size
2384}
2385
2386// appendBytesSliceIface encodes a [][]byte value as a repeated Bytes.
2387func appendBytesSliceIface(b []byte, ival interface{}, wiretag uint64, _ marshalOptions) ([]byte, error) {
2388 s := *ival.(*[][]byte)
2389 for _, v := range s {
2390 b = wire.AppendVarint(b, wiretag)
2391 b = wire.AppendBytes(b, v)
2392 }
2393 return b, nil
2394}
2395
2396var coderBytesSliceIface = ifaceCoderFuncs{
2397 size: sizeBytesSliceIface,
2398 marshal: appendBytesSliceIface,
2399}
2400
2401var wireTypes = map[protoreflect.Kind]wire.Type{
2402 protoreflect.BoolKind: wire.VarintType,
2403 protoreflect.EnumKind: wire.VarintType,
2404 protoreflect.Int32Kind: wire.VarintType,
2405 protoreflect.Sint32Kind: wire.VarintType,
2406 protoreflect.Uint32Kind: wire.VarintType,
2407 protoreflect.Int64Kind: wire.VarintType,
2408 protoreflect.Sint64Kind: wire.VarintType,
2409 protoreflect.Uint64Kind: wire.VarintType,
2410 protoreflect.Sfixed32Kind: wire.Fixed32Type,
2411 protoreflect.Fixed32Kind: wire.Fixed32Type,
2412 protoreflect.FloatKind: wire.Fixed32Type,
2413 protoreflect.Sfixed64Kind: wire.Fixed64Type,
2414 protoreflect.Fixed64Kind: wire.Fixed64Type,
2415 protoreflect.DoubleKind: wire.Fixed64Type,
2416 protoreflect.StringKind: wire.BytesType,
2417 protoreflect.BytesKind: wire.BytesType,
2418 protoreflect.MessageKind: wire.BytesType,
2419 protoreflect.GroupKind: wire.StartGroupType,
2420}