]> Cypherpunks repositories - gostls13.git/commit
math/big: correct quadratic space complexity in Mul.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Thu, 12 Jul 2012 17:18:24 +0000 (10:18 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 12 Jul 2012 17:18:24 +0000 (10:18 -0700)
commitac12131649391c6303f96514aee4424cb7a0b7d7
tree9f74abcc097ea8726970d1d5d36ef2c32b8b8260
parenteb1c03eacbbd1e3a8000972f338122dc9d5748b9
math/big: correct quadratic space complexity in Mul.

The previous implementation used to have a O(n) recursion
depth for unbalanced inputs. A test is added to check that a
reasonable amount of bytes is allocated in this case.

Fixes #3807.

R=golang-dev, dsymonds, gri
CC=golang-dev, remy
https://golang.org/cl/6345075
src/pkg/math/big/nat.go
src/pkg/math/big/nat_test.go