// Code generated by go run decgen.go -output dec_helpers.go; DO NOT EDIT.

// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package gob

import (
	
	
)

var decArrayHelper = map[reflect.Kind]decHelper{
	reflect.Bool:       decBoolArray,
	reflect.Complex64:  decComplex64Array,
	reflect.Complex128: decComplex128Array,
	reflect.Float32:    decFloat32Array,
	reflect.Float64:    decFloat64Array,
	reflect.Int:        decIntArray,
	reflect.Int16:      decInt16Array,
	reflect.Int32:      decInt32Array,
	reflect.Int64:      decInt64Array,
	reflect.Int8:       decInt8Array,
	reflect.String:     decStringArray,
	reflect.Uint:       decUintArray,
	reflect.Uint16:     decUint16Array,
	reflect.Uint32:     decUint32Array,
	reflect.Uint64:     decUint64Array,
	reflect.Uintptr:    decUintptrArray,
}

var decSliceHelper = map[reflect.Kind]decHelper{
	reflect.Bool:       decBoolSlice,
	reflect.Complex64:  decComplex64Slice,
	reflect.Complex128: decComplex128Slice,
	reflect.Float32:    decFloat32Slice,
	reflect.Float64:    decFloat64Slice,
	reflect.Int:        decIntSlice,
	reflect.Int16:      decInt16Slice,
	reflect.Int32:      decInt32Slice,
	reflect.Int64:      decInt64Slice,
	reflect.Int8:       decInt8Slice,
	reflect.String:     decStringSlice,
	reflect.Uint:       decUintSlice,
	reflect.Uint16:     decUint16Slice,
	reflect.Uint32:     decUint32Slice,
	reflect.Uint64:     decUint64Slice,
	reflect.Uintptr:    decUintptrSlice,
}

func decBoolArray( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decBoolSlice(, .Slice(0, .Len()), , )
}

func decBoolSlice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]bool)
	if ! {
		// It is kind bool but not type bool. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding bool array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		[] = .decodeUint() != 0
	}
	return true
}

func decComplex64Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decComplex64Slice(, .Slice(0, .Len()), , )
}

func decComplex64Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]complex64)
	if ! {
		// It is kind complex64 but not type complex64. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding complex64 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := float32FromBits(.decodeUint(), )
		 := float32FromBits(.decodeUint(), )
		[] = complex(float32(), float32())
	}
	return true
}

func decComplex128Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decComplex128Slice(, .Slice(0, .Len()), , )
}

func decComplex128Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]complex128)
	if ! {
		// It is kind complex128 but not type complex128. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding complex128 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := float64FromBits(.decodeUint())
		 := float64FromBits(.decodeUint())
		[] = complex(, )
	}
	return true
}

func decFloat32Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decFloat32Slice(, .Slice(0, .Len()), , )
}

func decFloat32Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]float32)
	if ! {
		// It is kind float32 but not type float32. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding float32 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		[] = float32(float32FromBits(.decodeUint(), ))
	}
	return true
}

func decFloat64Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decFloat64Slice(, .Slice(0, .Len()), , )
}

func decFloat64Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]float64)
	if ! {
		// It is kind float64 but not type float64. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding float64 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		[] = float64FromBits(.decodeUint())
	}
	return true
}

func decIntArray( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decIntSlice(, .Slice(0, .Len()), , )
}

func decIntSlice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]int)
	if ! {
		// It is kind int but not type int. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding int array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeInt()
		// MinInt and MaxInt
		if  < ^int64(^uint(0)>>1) || int64(^uint(0)>>1) <  {
			error_()
		}
		[] = int()
	}
	return true
}

func decInt16Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decInt16Slice(, .Slice(0, .Len()), , )
}

func decInt16Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]int16)
	if ! {
		// It is kind int16 but not type int16. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding int16 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeInt()
		if  < math.MinInt16 || math.MaxInt16 <  {
			error_()
		}
		[] = int16()
	}
	return true
}

func decInt32Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decInt32Slice(, .Slice(0, .Len()), , )
}

func decInt32Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]int32)
	if ! {
		// It is kind int32 but not type int32. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding int32 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeInt()
		if  < math.MinInt32 || math.MaxInt32 <  {
			error_()
		}
		[] = int32()
	}
	return true
}

func decInt64Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decInt64Slice(, .Slice(0, .Len()), , )
}

func decInt64Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]int64)
	if ! {
		// It is kind int64 but not type int64. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding int64 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		[] = .decodeInt()
	}
	return true
}

func decInt8Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decInt8Slice(, .Slice(0, .Len()), , )
}

func decInt8Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]int8)
	if ! {
		// It is kind int8 but not type int8. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding int8 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeInt()
		if  < math.MinInt8 || math.MaxInt8 <  {
			error_()
		}
		[] = int8()
	}
	return true
}

func decStringArray( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decStringSlice(, .Slice(0, .Len()), , )
}

func decStringSlice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]string)
	if ! {
		// It is kind string but not type string. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding string array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeUint()
		 := int()
		if  < 0 || uint64() !=  ||  > .b.Len() {
			errorf("length of string exceeds input size (%d bytes)", )
		}
		if  > .b.Len() {
			errorf("string data too long for buffer: %d", )
		}
		// Read the data.
		 := .b.Bytes()
		if len() <  {
			errorf("invalid string length %d: exceeds input size %d", , len())
		}
		[] = string([:])
		.b.Drop()
	}
	return true
}

func decUintArray( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decUintSlice(, .Slice(0, .Len()), , )
}

func decUintSlice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]uint)
	if ! {
		// It is kind uint but not type uint. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding uint array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeUint()
		/*TODO if math.MaxUint32 < x {
			error_(ovfl)
		}*/
		[] = uint()
	}
	return true
}

func decUint16Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decUint16Slice(, .Slice(0, .Len()), , )
}

func decUint16Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]uint16)
	if ! {
		// It is kind uint16 but not type uint16. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding uint16 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeUint()
		if math.MaxUint16 <  {
			error_()
		}
		[] = uint16()
	}
	return true
}

func decUint32Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decUint32Slice(, .Slice(0, .Len()), , )
}

func decUint32Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]uint32)
	if ! {
		// It is kind uint32 but not type uint32. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding uint32 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeUint()
		if math.MaxUint32 <  {
			error_()
		}
		[] = uint32()
	}
	return true
}

func decUint64Array( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decUint64Slice(, .Slice(0, .Len()), , )
}

func decUint64Slice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]uint64)
	if ! {
		// It is kind uint64 but not type uint64. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding uint64 array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		[] = .decodeUint()
	}
	return true
}

func decUintptrArray( *decoderState,  reflect.Value,  int,  error) bool {
	// Can only slice if it is addressable.
	if !.CanAddr() {
		return false
	}
	return decUintptrSlice(, .Slice(0, .Len()), , )
}

func decUintptrSlice( *decoderState,  reflect.Value,  int,  error) bool {
	,  := .Interface().([]uintptr)
	if ! {
		// It is kind uintptr but not type uintptr. TODO: We can handle this unsafely.
		return false
	}
	for  := 0;  < ; ++ {
		if .b.Len() == 0 {
			errorf("decoding uintptr array or slice: length exceeds input size (%d elements)", )
		}
		if  >= len() {
			// This is a slice that we only partially allocated.
			growSlice(, &, )
		}
		 := .decodeUint()
		if uint64(^uintptr(0)) <  {
			error_()
		}
		[] = uintptr()
	}
	return true
}

// growSlice is called for a slice that we only partially allocated,
// to grow it up to length.
func growSlice[ any]( reflect.Value,  *[],  int) {
	var  
	 := *
	 = append(, )
	 := cap()
	if  >  {
		 = 
	}
	 = [:]
	.Set(reflect.ValueOf())
	* = 
}