diff options
| author | Rob Pike <r@golang.org> | 2009-12-30 08:33:48 +1100 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2009-12-30 08:33:48 +1100 |
| commit | ee8ae7c23f9d535396f3ad7999343c6ab1509e70 (patch) | |
| tree | 496e10d9c339b8e3c617baf722db2a2146065156 /src/pkg/gob/decode.go | |
| parent | bc2788087c0f4a193aa4d2ac5b8376fac2cd1249 (diff) | |
| download | golang-ee8ae7c23f9d535396f3ad7999343c6ab1509e70.tar.gz | |
improve some type switches now that multiple types per case are supported.
R=rsc
CC=golang-dev
http://codereview.appspot.com/181089
Diffstat (limited to 'src/pkg/gob/decode.go')
| -rw-r--r-- | src/pkg/gob/decode.go | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/pkg/gob/decode.go b/src/pkg/gob/decode.go index 41951d357..88bc65d62 100644 --- a/src/pkg/gob/decode.go +++ b/src/pkg/gob/decode.go @@ -630,33 +630,11 @@ func (dec *Decoder) compatibleType(fr reflect.Type, fw typeId) bool { return false case *reflect.BoolType: return fw == tBool - case *reflect.IntType: + case *reflect.IntType, *reflect.Int8Type, *reflect.Int16Type, *reflect.Int32Type, *reflect.Int64Type: return fw == tInt - case *reflect.Int8Type: - return fw == tInt - case *reflect.Int16Type: - return fw == tInt - case *reflect.Int32Type: - return fw == tInt - case *reflect.Int64Type: - return fw == tInt - case *reflect.UintType: - return fw == tUint - case *reflect.Uint8Type: - return fw == tUint - case *reflect.Uint16Type: + case *reflect.UintType, *reflect.Uint8Type, *reflect.Uint16Type, *reflect.Uint32Type, *reflect.Uint64Type, *reflect.UintptrType: return fw == tUint - case *reflect.Uint32Type: - return fw == tUint - case *reflect.Uint64Type: - return fw == tUint - case *reflect.UintptrType: - return fw == tUint - case *reflect.FloatType: - return fw == tFloat - case *reflect.Float32Type: - return fw == tFloat - case *reflect.Float64Type: + case *reflect.FloatType, *reflect.Float32Type, *reflect.Float64Type: return fw == tFloat case *reflect.StringType: return fw == tString |
