summaryrefslogtreecommitdiff
path: root/misc/cgo/gmp/fib.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-12-15 15:33:31 -0800
committerRobert Griesemer <gri@golang.org>2009-12-15 15:33:31 -0800
commitd9527dd16f72598b54a64550607bf892efa12384 (patch)
tree2ad16a7db2d3c484b47426ad2568359ab633820c /misc/cgo/gmp/fib.go
parentaea97e0bd7da9cef1cc631ddbd3578a0877a4fcc (diff)
downloadgolang-d9527dd16f72598b54a64550607bf892efa12384.tar.gz
1) Change default gofmt default settings for
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 1st set of files. R=rsc CC=agl, golang-dev, iant, ken2, r http://codereview.appspot.com/180047
Diffstat (limited to 'misc/cgo/gmp/fib.go')
-rw-r--r--misc/cgo/gmp/fib.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/misc/cgo/gmp/fib.go b/misc/cgo/gmp/fib.go
index 1ff156ef2..3eda39e17 100644
--- a/misc/cgo/gmp/fib.go
+++ b/misc/cgo/gmp/fib.go
@@ -10,33 +10,33 @@
package main
import (
- big "gmp";
- "runtime";
+ big "gmp"
+ "runtime"
)
func fibber(c chan *big.Int, out chan string, n int64) {
// Keep the fibbers in dedicated operating system
// threads, so that this program tests coordination
// between pthreads and not just goroutines.
- runtime.LockOSThread();
+ runtime.LockOSThread()
- i := big.NewInt(n);
+ i := big.NewInt(n)
if n == 0 {
c <- i
}
for {
- j := <-c;
- out <- j.String();
- i.Add(i, j);
- c <- i;
+ j := <-c
+ out <- j.String()
+ i.Add(i, j)
+ c <- i
}
}
func main() {
- c := make(chan *big.Int);
- out := make(chan string);
- go fibber(c, out, 0);
- go fibber(c, out, 1);
+ c := make(chan *big.Int)
+ out := make(chan string)
+ go fibber(c, out, 0)
+ go fibber(c, out, 1)
for i := 0; i < 200; i++ {
println(<-out)
}