Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
fe79e436
Commit
fe79e436
authored
Oct 29, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update fmt to int/int32 etc split
R=rsc DELTA=9 (6 added, 0 deleted, 3 changed) OCL=18072 CL=18075
parent
e76e9cfc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
print.go
src/lib/fmt/print.go
+9
-3
No files found.
src/lib/fmt/print.go
View file @
fe79e436
...
...
@@ -158,6 +158,8 @@ func (p *P) sprintln(v reflect.Empty) string {
func
getInt
(
v
reflect
.
Value
)
(
val
int64
,
signed
,
ok
bool
)
{
switch
v
.
Kind
()
{
case
reflect
.
IntKind
:
return
int64
(
v
.
(
reflect
.
IntValue
)
.
Get
()),
true
,
true
;
case
reflect
.
Int8Kind
:
return
int64
(
v
.
(
reflect
.
Int8Value
)
.
Get
()),
true
,
true
;
case
reflect
.
Int16Kind
:
...
...
@@ -166,6 +168,8 @@ func getInt(v reflect.Value) (val int64, signed, ok bool) {
return
int64
(
v
.
(
reflect
.
Int32Value
)
.
Get
()),
true
,
true
;
case
reflect
.
Int64Kind
:
return
int64
(
v
.
(
reflect
.
Int64Value
)
.
Get
()),
true
,
true
;
case
reflect
.
UintKind
:
return
int64
(
v
.
(
reflect
.
UintValue
)
.
Get
()),
false
,
true
;
case
reflect
.
Uint8Kind
:
return
int64
(
v
.
(
reflect
.
Uint8Value
)
.
Get
()),
false
,
true
;
case
reflect
.
Uint16Kind
:
...
...
@@ -188,6 +192,8 @@ func getString(v reflect.Value) (val string, ok bool) {
func
getFloat
(
v
reflect
.
Value
)
(
val
float64
,
ok
bool
)
{
switch
v
.
Kind
()
{
case
reflect
.
FloatKind
:
return
float64
(
v
.
(
reflect
.
FloatValue
)
.
Get
()),
true
;
case
reflect
.
Float32Kind
:
return
float64
(
v
.
(
reflect
.
Float32Value
)
.
Get
()),
true
;
case
reflect
.
Float64Kind
:
...
...
@@ -363,13 +369,13 @@ func (p *P) doprint(v reflect.StructValue, is_println bool) {
p
.
add
(
' '
)
}
switch
field
.
Kind
()
{
case
reflect
.
Int8Kind
,
reflect
.
Int16Kind
,
reflect
.
Int32Kind
,
reflect
.
Int64Kind
:
case
reflect
.
Int
Kind
,
reflect
.
Int
8Kind
,
reflect
.
Int16Kind
,
reflect
.
Int32Kind
,
reflect
.
Int64Kind
:
v
,
signed
,
ok
:=
getInt
(
field
);
s
=
p
.
fmt
.
d64
(
v
)
.
str
();
case
reflect
.
Uint8Kind
,
reflect
.
Uint16Kind
,
reflect
.
Uint32Kind
,
reflect
.
Uint64Kind
:
case
reflect
.
Uint
Kind
,
reflect
.
Uint
8Kind
,
reflect
.
Uint16Kind
,
reflect
.
Uint32Kind
,
reflect
.
Uint64Kind
:
v
,
signed
,
ok
:=
getInt
(
field
);
s
=
p
.
fmt
.
ud64
(
uint64
(
v
))
.
str
();
case
reflect
.
Float32Kind
,
reflect
.
Float64Kind
,
reflect
.
Float80Kind
:
case
reflect
.
Float
Kind
,
reflect
.
Float
32Kind
,
reflect
.
Float64Kind
,
reflect
.
Float80Kind
:
v
,
ok
:=
getFloat
(
field
);
s
=
p
.
fmt
.
g64
(
v
)
.
str
();
case
reflect
.
StringKind
:
...
...
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