mirror of
https://github.com/golang/go
synced 2024-11-22 02:14:40 -07:00
big: bug fix for division
Fixes #784. R=rsc CC=golang-dev https://golang.org/cl/1196043
This commit is contained in:
parent
2db47c9083
commit
90d0c3316c
@ -528,10 +528,15 @@ func (z nat) divLarge(u, uIn, v nat) (q, r nat) {
|
|||||||
n := len(v)
|
n := len(v)
|
||||||
m := len(uIn) - n
|
m := len(uIn) - n
|
||||||
|
|
||||||
|
// determine if z can be reused
|
||||||
|
if alias(z, uIn) || alias(z, v) {
|
||||||
|
z = nil // z is an alias for uIn or v - cannot reuse
|
||||||
|
}
|
||||||
q = z.make(m + 1)
|
q = z.make(m + 1)
|
||||||
|
|
||||||
qhatv := make(nat, n+1)
|
qhatv := make(nat, n+1)
|
||||||
if alias(u, uIn) {
|
if alias(u, uIn) || alias(u, v) {
|
||||||
u = nil // u is an alias for uIn - cannot reuse
|
u = nil // u is an alias for uIn or v - cannot reuse
|
||||||
}
|
}
|
||||||
u = u.make(len(uIn) + 1)
|
u = u.make(len(uIn) + 1)
|
||||||
u.clear()
|
u.clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user