Source File
dec_helpers.go
Belonging Package
encoding/gob
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,
}
return false
}
for := 0; < ; ++ {
if .b.Len() == 0 {
errorf("decoding complex64 array or slice: length exceeds input size (%d elements)", )
}
:= float32FromBits(.decodeUint(), )
:= float32FromBits(.decodeUint(), )
[] = complex(float32(), float32())
}
return true
}
if !.CanAddr() {
return false
}
return decComplex128Slice(, .Slice(0, .Len()), , )
}
func ( *decoderState, reflect.Value, int, error) bool {
, := .Interface().([]complex128)
return false
}
for := 0; < ; ++ {
if .b.Len() == 0 {
errorf("decoding complex128 array or slice: length exceeds input size (%d elements)", )
}
:= float64FromBits(.decodeUint())
:= float64FromBits(.decodeUint())
[] = complex(, )
}
return true
}
return false
}
for := 0; < ; ++ {
if .b.Len() == 0 {
errorf("decoding float32 array or slice: length exceeds input size (%d elements)", )
}
[] = float32(float32FromBits(.decodeUint(), ))
}
return true
}
return false
}
for := 0; < ; ++ {
if .b.Len() == 0 {
errorf("decoding float64 array or slice: length exceeds input size (%d elements)", )
}
[] = float64FromBits(.decodeUint())
}
return true
}
return false
}
for := 0; < ; ++ {
if .b.Len() == 0 {
errorf("decoding string array or slice: length exceeds input size (%d elements)", )
}
:= .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", )
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |