Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
a58b69e1
Commit
a58b69e1
authored
Dec 30, 2009
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve some type switches now that multiple types per case are supported.
R=rsc CC=golang-dev
https://golang.org/cl/181089
parent
e01459f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
50 deletions
+6
-50
src/pkg/gob/decode.go
src/pkg/gob/decode.go
+3
-25
src/pkg/gob/type.go
src/pkg/gob/type.go
+3
-25
No files found.
src/pkg/gob/decode.go
View file @
a58b69e1
...
...
@@ -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
...
...
src/pkg/gob/type.go
View file @
a58b69e1
...
...
@@ -212,35 +212,13 @@ func newTypeObject(name string, rt reflect.Type) (gobType, os.Error) {
case
*
reflect
.
BoolType
:
return
tBool
.
gobType
(),
nil
case
*
reflect
.
IntType
:
return
tInt
.
gobType
(),
nil
case
*
reflect
.
Int8Type
:
return
tInt
.
gobType
(),
nil
case
*
reflect
.
Int16Type
:
return
tInt
.
gobType
(),
nil
case
*
reflect
.
Int32Type
:
return
tInt
.
gobType
(),
nil
case
*
reflect
.
Int64Type
:
case
*
reflect
.
IntType
,
*
reflect
.
Int8Type
,
*
reflect
.
Int16Type
,
*
reflect
.
Int32Type
,
*
reflect
.
Int64Type
:
return
tInt
.
gobType
(),
nil
case
*
reflect
.
UintType
:
return
tUint
.
gobType
(),
nil
case
*
reflect
.
Uint8Type
:
return
tUint
.
gobType
(),
nil
case
*
reflect
.
Uint16Type
:
return
tUint
.
gobType
(),
nil
case
*
reflect
.
Uint32Type
:
return
tUint
.
gobType
(),
nil
case
*
reflect
.
Uint64Type
:
return
tUint
.
gobType
(),
nil
case
*
reflect
.
UintptrType
:
case
*
reflect
.
UintType
,
*
reflect
.
Uint8Type
,
*
reflect
.
Uint16Type
,
*
reflect
.
Uint32Type
,
*
reflect
.
Uint64Type
,
*
reflect
.
UintptrType
:
return
tUint
.
gobType
(),
nil
case
*
reflect
.
FloatType
:
return
tFloat
.
gobType
(),
nil
case
*
reflect
.
Float32Type
:
return
tFloat
.
gobType
(),
nil
case
*
reflect
.
Float64Type
:
case
*
reflect
.
FloatType
,
*
reflect
.
Float32Type
,
*
reflect
.
Float64Type
:
return
tFloat
.
gobType
(),
nil
case
*
reflect
.
StringType
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment