diff --git a/src/cmd/vet/all/whitelist/64bit.txt b/src/cmd/vet/all/whitelist/64bit.txt index b2c8e05b59..39855f7d70 100644 --- a/src/cmd/vet/all/whitelist/64bit.txt +++ b/src/cmd/vet/all/whitelist/64bit.txt @@ -22,7 +22,5 @@ math/big/arith.go: (xi&yi | (xi|yi)&^zi) might be too small for shift of 63 math/big/arith.go: (yi&^xi | (yi|^xi)&zi) might be too small for shift of 63 math/big/arith.go: xi &^ zi might be too small for shift of 63 math/big/arith.go: (zi &^ xi) might be too small for shift of 63 -math/big/nat.go: t too small for shift of 64 -math/big/nat.go: x too small for shift of 64 math/big/nat.go: yi might be too small for shift of 60 math/big/nat.go: yi might be too small for shift of 60 diff --git a/src/math/big/nat.go b/src/math/big/nat.go index 1e6f7ae8a8..67176553b0 100644 --- a/src/math/big/nat.go +++ b/src/math/big/nat.go @@ -68,24 +68,14 @@ func (z nat) setWord(x Word) nat { } func (z nat) setUint64(x uint64) nat { - // single-digit values + // single-word value if w := Word(x); uint64(w) == x { return z.setWord(w) } - - // compute number of words n required to represent x - n := 0 - for t := x; t > 0; t >>= _W { - n++ - } - - // split x into n words - z = z.make(n) - for i := range z { - z[i] = Word(x & _M) - x >>= _W - } - + // 2-word value + z = z.make(2) + z[1] = Word(x >> 32) + z[0] = Word(x) return z }