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
7d7ebd2f
Commit
7d7ebd2f
authored
May 04, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime, strconv: tiny cleanups
R=r CC=golang-dev
https://golang.org/cl/1081042
parent
a9425c70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
15 deletions
+6
-15
slice.c
src/pkg/runtime/slice.c
+1
-3
decimal.go
src/pkg/strconv/decimal.go
+5
-12
No files found.
src/pkg/runtime/slice.c
View file @
7d7ebd2f
...
...
@@ -186,9 +186,7 @@ void
void
·
slicecopy
(
Slice
to
,
Slice
fm
,
uintptr
width
,
int32
ret
)
{
if
(
fm
.
array
==
nil
||
fm
.
len
==
0
||
to
.
array
==
nil
||
to
.
len
==
0
||
width
==
0
)
{
if
(
fm
.
len
==
0
||
to
.
len
==
0
||
width
==
0
)
{
ret
=
0
;
goto
out
;
}
...
...
src/pkg/strconv/decimal.go
View file @
7d7ebd2f
...
...
@@ -41,32 +41,25 @@ func (a *decimal) String() string {
buf
[
w
]
=
'.'
w
++
w
+=
digitZero
(
buf
[
w
:
w
+-
a
.
dp
])
w
+=
copy
(
buf
[
w
:
w
+
a
.
nd
],
a
.
d
[
0
:
a
.
nd
])
w
+=
copy
(
buf
[
w
:
],
a
.
d
[
0
:
a
.
nd
])
case
a
.
dp
<
a
.
nd
:
// decimal point in middle of digits
w
+=
copy
(
buf
[
w
:
w
+
a
.
dp
],
a
.
d
[
0
:
a
.
dp
])
w
+=
copy
(
buf
[
w
:
],
a
.
d
[
0
:
a
.
dp
])
buf
[
w
]
=
'.'
w
++
w
+=
copy
(
buf
[
w
:
w
+
a
.
nd
-
a
.
dp
],
a
.
d
[
a
.
dp
:
a
.
nd
])
w
+=
copy
(
buf
[
w
:
],
a
.
d
[
a
.
dp
:
a
.
nd
])
default
:
// zeros fill space between digits and decimal point
w
+=
copy
(
buf
[
w
:
w
+
a
.
nd
],
a
.
d
[
0
:
a
.
nd
])
w
+=
copy
(
buf
[
w
:
],
a
.
d
[
0
:
a
.
nd
])
w
+=
digitZero
(
buf
[
w
:
w
+
a
.
dp
-
a
.
nd
])
}
return
string
(
buf
[
0
:
w
])
}
func
copy
(
dst
[]
byte
,
src
[]
byte
)
int
{
for
i
:=
0
;
i
<
len
(
dst
);
i
++
{
dst
[
i
]
=
src
[
i
]
}
return
len
(
dst
)
}
func
digitZero
(
dst
[]
byte
)
int
{
for
i
:=
0
;
i
<
len
(
dst
);
i
++
{
for
i
:=
range
dst
{
dst
[
i
]
=
'0'
}
return
len
(
dst
)
...
...
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