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

Unified Diff: src/pkg/big/int.go

Issue 1004042: code review 1004042: big: implemented Karatsuba multiplication (Closed)
Patch Set: code review 1004042: big: implemented Karatsuba multiplication Created 13 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/pkg/big/int.go
===================================================================
--- a/src/pkg/big/int.go
+++ b/src/pkg/big/int.go
@@ -230,7 +230,7 @@
// sets z to that value.
func (z *Int) SetBytes(b []byte) *Int {
s := int(_S)
- z.abs = z.abs.make((len(b)+s-1)/s, false)
+ z.abs = z.abs.make((len(b) + s - 1) / s)
z.neg = false
j := 0
@@ -386,7 +386,7 @@
func (z *Int) Lsh(x *Int, n uint) *Int {
addedWords := int(n) / _W
// Don't assign z.abs yet, in case z == x
- znew := z.abs.make(len(x.abs)+addedWords+1, false)
+ znew := z.abs.make(len(x.abs) + addedWords + 1)
z.neg = x.neg
znew[addedWords:].shiftLeft(x.abs, n%_W)
for i := range znew[0:addedWords] {
@@ -401,7 +401,7 @@
func (z *Int) Rsh(x *Int, n uint) *Int {
removedWords := int(n) / _W
// Don't assign z.abs yet, in case z == x
- znew := z.abs.make(len(x.abs)-removedWords, false)
+ znew := z.abs.make(len(x.abs) - removedWords)
z.neg = x.neg
znew.shiftRight(x.abs[removedWords:], n%_W)
z.abs = znew.norm()
« no previous file with comments | « src/pkg/big/calibrate_test.go ('k') | src/pkg/big/int_test.go » ('j') | src/pkg/big/nat.go » ('J')

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