Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(88)

Delta Between Two Patch Sets: src/pkg/big/nat_test.go

Issue 1004042: code review 1004042: big: implemented Karatsuba multiplication (Closed)
Left Patch Set: code review 1004042: big: implemented Karatsuba multiplication Created 13 years, 11 months ago
Right Patch Set: code review 1004042: big: implemented Karatsuba multiplication Created 13 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« src/pkg/big/nat.go ('K') | « src/pkg/big/nat.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package big 5 package big
6 6
7 import "testing" 7 import "testing"
8 8
9 type cmpTest struct { 9 type cmpTest struct {
10 x, y nat 10 x, y nat
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 mulArg = make(nat, n) 154 mulArg = make(nat, n)
155 for i := 0; i < n; i++ { 155 for i := 0; i < n; i++ {
156 mulArg[i] = _M 156 mulArg[i] = _M
157 } 157 }
158 } 158 }
159 159
160 160
161 func BenchmarkMul(b *testing.B) { 161 func BenchmarkMul(b *testing.B) {
162 for i := 0; i < b.N; i++ { 162 for i := 0; i < b.N; i++ {
163 var t nat 163 var t nat
164 » » t.mul(mulArg, mulArg) 164 » » for j := 1; j <= 10; j++ {
165 » » » x := mulArg[0 : j*100]
166 » » » t.mul(x, x)
167 » » }
165 } 168 }
166 } 169 }
167 170
168 171
169 type strN struct { 172 type strN struct {
170 x nat 173 x nat
171 b int 174 b int
172 s string 175 s string
173 } 176 }
174 177
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 if len(test.m) > 0 { 359 if len(test.m) > 0 {
357 m, _, _ = nat(nil).scan(test.m, 0) 360 m, _, _ = nat(nil).scan(test.m, 0)
358 } 361 }
359 362
360 z := nat(nil).expNN(x, y, m) 363 z := nat(nil).expNN(x, y, m)
361 if z.cmp(out) != 0 { 364 if z.cmp(out) != 0 {
362 t.Errorf("#%d got %v want %v", i, z, out) 365 t.Errorf("#%d got %v want %v", i, z, out)
363 } 366 }
364 } 367 }
365 } 368 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b