math/big: add 4-bit, fixed window exponentiation.

A 4-bit window is convenient because 4 divides both 32 and 64,
therefore we never have a window spanning words of the exponent.
Additionaly, the benefit of a 5-bit window is only 2.6% at 1024-bits
and 3.3% at 2048-bits.

This code is still not constant time, however.

benchmark                        old ns/op    new ns/op    delta
BenchmarkRSA2048Decrypt           17108590     11180370  -34.65%
Benchmark3PrimeRSA2048Decrypt     13003720      7680390  -40.94%

R=gri
CC=golang-dev
http://codereview.appspot.com/6716048
cmd/go: Dedup package arguments before building.

Fixes issue 4104.

R=golang-dev, dave, minux.ma
CC=golang-dev
http://codereview.appspot.com/6639051
go spec: restrictions for index and slice expressions

At the moment, gc and gccgo report compile-
time errors for certain constant indexes that
are out of bounds. The spec however requests
a run-time panic for out-of-bounds indexes
(http://tip.golang.org/ref/spec#Indexes).

Document the status quo.

Fixes issue 4231.

R=r, rsc, iant, ken
CC=golang-dev
http://codereview.appspot.com/6699048
A+C: add Shane Hansen (Individual CLA)

R=golang-dev, iant
CC=golang-dev
http://codereview.appspot.com/6714053
crypto/cipher: panic on invalid IV length

Give better user feedback when invalid IV is used
to construct a cipher.

Fixes issue 3411

R=golang-dev, agl
CC=golang-dev
http://codereview.appspot.com/6652053

Committer: Adam Langley <agl@golang.org>
cmd/gc: don't squash complex literals when inlining.

Since this patch changes the way complex literals are written
in export data, there are a few other glitches.

Fixes issue 4159.

R=golang-dev, rsc
CC=golang-dev, remy
http://codereview.appspot.com/6674047
doc/codewalk/markov: fix the highlight range of the step "The NewChain constructor function".

R=r, minux.ma, adg
CC=golang-dev
http://codereview.appspot.com/6710044

Committer: Andrew Gerrand <adg@golang.org>
exp/html: update package docs and add an example; a node's children is
a linked list, not a slice.

R=r, minux.ma
CC=golang-dev
http://codereview.appspot.com/6618055
A+C: Stephen McQuay (Individual CLA)

R=golang-dev, iant
CC=golang-dev
http://codereview.appspot.com/6733043
net: add LookupNS(domain string)
Fixes issue 4224.

R=golang-dev, dave, minux.ma, mikioh.mikioh, alex.brainman, rsc, herbert.fischer
CC=golang-dev
http://codereview.appspot.com/6675043

Committer: Mikio Hara <mikioh.mikioh@gmail.com>
image/jpeg: make TestDCT faster.

The value of cosines are cached in a global array
instead of being recomputed each time.
The test was terribly slow on arm.

R=golang-dev, dave, nigeltao
CC=golang-dev
http://codereview.appspot.com/6733046
encoding/xml: correctly escape newline, carriage return, and tab

The generated encodings are those from
http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html#charescaping

The change to the decoder ensures that we turn &#xD; in the
input into \r, not \n.

R=golang-dev, bradfitz
CC=golang-dev
http://codereview.appspot.com/6747043
image/draw: fast-path for 4:4:0 chroma subsampled sources.

R=r
CC=golang-dev
http://codereview.appspot.com/6699049
runtime: update comment for the "extern register" variables g and m.

R=rsc, minux.ma, ality
CC=dave, golang-dev
http://codereview.appspot.com/6620050
bufio: Implement io.ReaderFrom for (*Writer).

This is part 2 of 2 for issue 4028.

benchmark                        old ns/op    new ns/op    delta
BenchmarkWriterCopyOptimal           53293        28326  -46.85%
BenchmarkWriterCopyUnoptimal         53757        30537  -43.19%
BenchmarkWriterCopyNoReadFrom        53192        36642  -31.11%

Fixes issue 4028.

R=nigeltao
CC=golang-dev
http://codereview.appspot.com/6565056

Committer: Nigel Tao <nigeltao@golang.org>
bufio: make Writer.ReadFrom not flush prematurely. For example,
many small writes to a network may be less efficient that a few
large writes.

This fixes net/http's TestClientWrites, broken by 6565056 that
introduced Writer.ReadFrom. That test implicitly assumed that
calling io.Copy on a *bufio.Writer wouldn't write to the
underlying network until the buffer was full.

R=dsymonds
CC=bradfitz, golang-dev, mchaten, mikioh.mikioh
http://codereview.appspot.com/6743044
unsafe: fix a typo

R=golang-dev, dsymonds
CC=golang-dev
http://codereview.appspot.com/6736048

Committer: David Symonds <dsymonds@golang.org>
go spec: define make() restrictions as for index expressions

This is a language change: Until now, the spec required run-
time panics for some of these errors. Note that gc and gccgo
implemented this inconsistently, and that both compilers already
reported compile-time errors in some cases. This change makes
make() behave along the same vein as index expressions.

This addresses the spec aspect of issue 4085.

R=r, rsc, iant, ken
CC=golang-dev
http://codereview.appspot.com/6725053
go spec: constant divisors must not be zero

Both gc and gccgo always checked this for constant
expressions but the spec only mentions run-time
exceptions.

This CL also requires that constant divisors
must not be zero in non-constant integer expressions:
This is consistent with the spirit of the most
recent changes and it is consistent with constant
expressions. We don't want to specify the effect for
non-integer expressions (f/0.0 where f is a float or
complex number) because there the result f/g is not
further specified if a non-constant g is 0.

R=r, rsc, iant, ken, andybalholm, iant
CC=golang-dev
http://codereview.appspot.com/6710045
bufio: remove a little unnecessary indirection in tests.

R=mchaten, r
CC=golang-dev
http://codereview.appspot.com/6739045