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
a074e374
Commit
a074e374
authored
Nov 06, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gofmt -w misc
R=rsc
http://go/go-review/1025004
parent
52c549fc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
12 deletions
+11
-12
gmp.go
misc/cgo/gmp/gmp.go
+3
-3
pi.go
misc/cgo/gmp/pi.go
+7
-7
file.go
misc/cgo/stdio/file.go
+0
-1
hello.go
misc/cgo/stdio/hello.go
+1
-1
No files found.
misc/cgo/gmp/gmp.go
View file @
a074e374
...
...
@@ -115,8 +115,8 @@ import (
// An Int represents a signed multi-precision integer.
// The zero value for an Int represents the value 0.
type
Int
struct
{
i
C
.
mpz_t
;
init
bool
;
i
C
.
mpz_t
;
init
bool
;
}
// NewInt returns a new Int initialized to x.
...
...
@@ -140,7 +140,7 @@ func (z *Int) doinit() {
// Bytes returns z's representation as a big-endian byte array.
func
(
z
*
Int
)
Bytes
()
[]
byte
{
b
:=
make
([]
byte
,
(
z
.
Len
()
+
7
)
/
8
);
b
:=
make
([]
byte
,
(
z
.
Len
()
+
7
)
/
8
);
n
:=
C
.
size_t
(
len
(
b
));
C
.
mpz_export
(
unsafe
.
Pointer
(
&
b
[
0
]),
&
n
,
1
,
1
,
1
,
0
,
&
z
.
i
[
0
]);
return
b
[
0
:
n
];
...
...
misc/cgo/gmp/pi.go
View file @
a074e374
...
...
@@ -44,12 +44,12 @@ import (
)
var
(
tmp1
=
big
.
NewInt
(
0
);
tmp2
=
big
.
NewInt
(
0
);
numer
=
big
.
NewInt
(
1
);
accum
=
big
.
NewInt
(
0
);
denom
=
big
.
NewInt
(
1
);
ten
=
big
.
NewInt
(
10
);
tmp1
=
big
.
NewInt
(
0
);
tmp2
=
big
.
NewInt
(
0
);
numer
=
big
.
NewInt
(
1
);
accum
=
big
.
NewInt
(
0
);
denom
=
big
.
NewInt
(
1
);
ten
=
big
.
NewInt
(
10
);
)
func
extractDigit
()
int64
{
...
...
@@ -90,7 +90,7 @@ func main() {
d
=
extractDigit
();
}
eliminateDigit
(
d
);
fmt
.
Printf
(
"%c"
,
d
+
'0'
);
fmt
.
Printf
(
"%c"
,
d
+
'0'
);
if
i
++
;
i
%
50
==
0
{
fmt
.
Printf
(
"
\n
"
);
...
...
misc/cgo/stdio/file.go
View file @
a074e374
...
...
@@ -40,4 +40,3 @@ func Puts(s string) {
C
.
free
(
unsafe
.
Pointer
(
p
));
C
.
fflushstdout
();
}
misc/cgo/stdio/hello.go
View file @
a074e374
...
...
@@ -7,6 +7,6 @@ package main
import
"stdio"
func
main
()
{
// stdio.Stdout.WriteString("hello, world\n");
// stdio.Stdout.WriteString("hello, world\n");
stdio
.
Puts
(
"hello, world"
);
}
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