reorganize loop
This commit is contained in:
parent
cafef6a4a2
commit
67c95db7ba
|
|
@ -42,13 +42,15 @@ func gaussianBrackets(ch <-chan *big.Int) <-chan *big.Int {
|
||||||
x := big.NewInt(1)
|
x := big.NewInt(1)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
out <- big.NewInt(1)
|
tmp := new(big.Int)
|
||||||
for a := range ch {
|
for a := range ch {
|
||||||
tmp := new(big.Int).Mul(a, x)
|
out <- x
|
||||||
|
|
||||||
|
tmp.Mul(a, x)
|
||||||
tmp.Add(tmp, xprev)
|
tmp.Add(tmp, xprev)
|
||||||
|
|
||||||
xprev.Set(x)
|
xprev.Set(x)
|
||||||
x.Set(tmp)
|
x = new(big.Int).Set(tmp)
|
||||||
out <- tmp
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue