aboutsummaryrefslogtreecommitdiff
path: root/src/math
AgeCommit message (Collapse)Author
2023-02-02math/big: add Int.Float64 conversionAlan Donovan
This operation converts a big.Int to float64, reporting the accuracy of the result, with a fast path in hardware. Fixes #56984 Change-Id: I86d0fb0e105a06a4009986f2f5fd87a4d446f6f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/453115 Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Alan Donovan <adonovan@google.com>
2023-01-24math: handle int64 overflows for odd integer exponents in Pow(-0, y)Dmitry Panov
The existing implementation does a float64 to int64 conversion in order to check whether the number is odd, however it does not check for overflows. If an overflow occurs, the result is implementation-defined and while it happens to work on amd64 and i386, it produces an incorrect result on arm64 and possibly other architectures. This change fixes that and also avoids calling isOddInt altogether if the base is +0, because it's unnecessary. (I was considering avoiding the extra check if runtime.GOARCH is "amd64" or "i386", but I can't see this pattern being used anywhere outside the tests. And having separate files with build tags just for isOddInt() seems like an overkill) Fixes #57465 Change-Id: Ieb243796194412aa6b98fac05fd19766ca2413ef GitHub-Last-Rev: 3bfbd85c4cd6c5dc3d15239e180c99764a19ca88 GitHub-Pull-Request: golang/go#57494 Reviewed-on: https://go-review.googlesource.com/c/go/+/459815 Auto-Submit: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Bypass: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2023-01-23math/big: validate result of Float.GobDecodeAlexander Yastrebov
Fixes #57946 Change-Id: Ia499ebfd8801432122f89fdf6bda4d1e7b6dd832 GitHub-Last-Rev: 29e099388680bc5b7075e0fa63499b39697579ca GitHub-Pull-Request: golang/go#57951 Reviewed-on: https://go-review.googlesource.com/c/go/+/463017 Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2023-01-19internal/godebug: export non-default-behavior counters in runtime/metricsRuss Cox
Allow GODEBUG users to report how many times a setting resulted in non-default behavior. Record non-default-behaviors for all existing GODEBUGs. Also rework tests to ensure that runtime is in sync with runtime/metrics.All, and generate docs mechanically from metrics.All. For #56986. Change-Id: Iefa1213e2a5c3f19ea16cd53298c487952ef05a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/453618 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-12-02math/big: fix BitLen performance regressionFilippo Valsorda
CL 450055 replaced BitLen with a slower constant-time implementation, which caused a performance regression in some ecosystem benchmarks. https://perf.golang.org/search?q=upload%3A20221130.13+pkg%3Agithub.com%2Fericlagergren%2Fdecimal%2Fbenchmarks Current tip vs this CL name old time/op new time/op delta Pi/foo=ericlagergren_(Go)/prec=100-4 151µs ± 0% 129µs ± 0% -14.89% (p=0.000 n=10+9) Pi/foo=ericlagergren_(GDA)/prec=100-4 305µs ± 0% 269µs ± 1% -11.88% (p=0.000 n=9+10) Pi/foo=cockroachdb/apd/prec=100-4 5.74ms ± 0% 5.33ms ± 0% -7.02% (p=0.000 n=9+10) Pi/foo=shopspring/prec=100-4 265µs ±16% 268µs ±11% ~ (p=0.796 n=10+10) Pi/foo=apmckinlay/prec=100-4 3.10µs ± 0% 3.08µs ± 0% -0.60% (p=0.000 n=8+10) Pi/foo=go-inf/prec=100-4 132µs ± 9% 137µs ± 9% ~ (p=0.182 n=10+9) Pi/foo=float64/prec=100-4 4.97µs ± 0% 4.98µs ± 0% ~ (p=0.196 n=10+10) CL 450055's parent vs this CL name old time/op new time/op delta Pi/foo=ericlagergren_(Go)/prec=100-4 129µs ± 1% 129µs ± 0% ~ (p=0.182 n=10+9) Pi/foo=ericlagergren_(GDA)/prec=100-4 267µs ± 1% 269µs ± 1% +0.93% (p=0.001 n=9+10) Pi/foo=shopspring/prec=100-4 252µs ± 9% 268µs ±11% ~ (p=0.052 n=10+10) Pi/foo=apmckinlay/prec=100-4 3.10µs ± 1% 3.08µs ± 0% -0.66% (p=0.000 n=9+10) Pi/foo=go-inf/prec=100-4 135µs ± 6% 137µs ± 9% ~ (p=0.605 n=9+9) Pi/foo=float64/prec=100-4 4.97µs ± 0% 4.98µs ± 0% +0.23% (p=0.005 n=8+10) goos: linux goarch: amd64 pkg: github.com/ericlagergren/decimal_benchmarks cpu: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz Fixes #57014 Change-Id: I08478bea122212320a592ad2652e33077807de09 Reviewed-on: https://go-review.googlesource.com/c/go/+/454617 Reviewed-by: Roland Shoemaker <roland@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-21crypto/internal/bigmod: move nat implementation out of crypto/rsaFilippo Valsorda
This will let us reuse it in crypto/ecdsa for the NIST scalar fields. The main change in API is around encoding and decoding. The SetBytes + ExpandFor sequence was hacky: SetBytes could produce a bigger size than the modulus if leading zeroes in the top byte overflowed the limb boundary, so ExpandFor had to check for and tolerate that. Also, the caller was responsible for checking that the overflow was actually all zeroes (which we weren't doing, exposing a crasher in decryption and signature verification) and then for checking that the result was less than the modulus. Instead, make SetBytes take a modulus and return an error if the value overflows. Same with Bytes: we were always allocating based on Size before FillBytes anyway, so now Bytes takes a modulus. Finally, SetBig was almost only used for moduli, so replaced NewModulusFromNat and SetBig with NewModulusFromBig. Moved the constant-time bitLen to math/big.Int.BitLen. It's slower, but BitLen is primarily used in cryptographic code, so it's safer this way. Change-Id: Ibaf7f36d80695578cb80484167d82ce1aa83832f Reviewed-on: https://go-review.googlesource.com/c/go/+/450055 Auto-Submit: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-11-18all: add missing periods in commentscui fliter
Change-Id: I69065f8adf101fdb28682c55997f503013a50e29 Reviewed-on: https://go-review.googlesource.com/c/go/+/449757 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Joedian Reid <joedian@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Joedian Reid <joedian@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-16math/rand: deprecate SeedRuss Cox
Programs that call Seed and then expect a specific sequence of results from the global random source (using functions such as Int) can be broken when a dependency changes how much it consumes from the global random source. To avoid such breakages, programs that need a specific result sequence should use NewRand(NewSource(seed)) to obtain a random generator that other packages cannot access. Fixes #56319. Change-Id: Idac33991b719d2c71f109f51dacb3467a649e01e Reviewed-on: https://go-review.googlesource.com/c/go/+/451375 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
2022-11-14internal/godebug: define more efficient APIRuss Cox
We have been expanding our use of GODEBUG for compatibility, and the current implementation forces a tradeoff between freshness and efficiency. It parses the environment variable in full each time it is called, which is expensive. But if clients cache the result, they won't respond to run-time GODEBUG changes, as happened with x509sha1 (#56436). This CL changes the GODEBUG API to provide efficient, up-to-date results. Instead of a single Get function, New returns a *godebug.Setting that itself has a Get method. Clients can save the result of New, which is no more expensive than errors.New, in a global variable, and then call that variable's Get method to get the value. Get costs only two atomic loads in the case where the variable hasn't changed since the last call. Unfortunately, these changes do require importing sync from godebug, which will mean that sync itself will never be able to use a GODEBUG setting. That doesn't seem like such a hardship. If it was really necessary, the runtime could pass a setting to package sync itself at startup, with the caveat that that setting, like the ones used by runtime itself, would not respond to run-time GODEBUG changes. Change-Id: I99a3acfa24fb2a692610af26a5d14bbc62c966ac Reviewed-on: https://go-review.googlesource.com/c/go/+/449504 Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-14math/bits: directly calculate quo/rem when hi is zero in Div64ruinan
func Div64(hi, lo, y uint64) (quo, rem uint64) {...} math/bits.Div64 returns the quotient and remainder of (hi, lo) divided by y. When hi is zero, we can directly return lo/y, lo%y, which can save a lot of unnecessary calculations. The performance is measured on arm64 and the changes will only affect the arch that doesn't have the intrinsic. name old time/op new time/op delta DivWVW/1-10 4.62ns ± 1% 2.45ns ± 1% -46.97% DivWVW/2-10 12.4ns ± 0% 12.2ns ± 0% -1.38% DivWVW/3-10 17.4ns ± 1% 17.2ns ± 0% -0.88% DivWVW/4-10 21.4ns ± 1% 21.6ns ± 0% +0.75% DivWVW/5-10 22.1ns ± 1% 21.9ns ± 0% -0.69% DivWVW/10-10 53.4ns ± 1% 53.0ns ± 1% -0.69% DivWVW/100-10 641ns ± 1% 633ns ± 0% -1.26% DivWVW/1000-10 5.52µs ± 1% 5.44µs ± 0% -1.39% DivWVW/10000-10 54.9µs ± 1% 54.7µs ± 1% -0.54% DivWVW/100000-10 646µs ± 1% 643µs ± 1% ~ name old speed new speed delta DivWVW/1-10 13.8GB/s ± 1% 26.1GB/s ± 1% +88.57% DivWVW/2-10 10.3GB/s ± 0% 10.5GB/s ± 0% +1.39% DivWVW/3-10 11.1GB/s ± 1% 11.2GB/s ± 0% +0.90% DivWVW/4-10 12.0GB/s ± 1% 11.9GB/s ± 0% -0.74% DivWVW/5-10 14.5GB/s ± 1% 14.6GB/s ± 0% +0.69% DivWVW/10-10 12.0GB/s ± 1% 12.1GB/s ± 1% +0.69% DivWVW/100-10 10.0GB/s ± 1% 10.1GB/s ± 0% +1.28% DivWVW/1000-10 11.6GB/s ± 1% 11.8GB/s ± 0% +1.41% DivWVW/10000-10 11.6GB/s ± 1% 11.7GB/s ± 1% +0.54% DivWVW/100000-10 9.91GB/s ± 1% 9.95GB/s ± 1% ~ Change-Id: I12014c2e2cdb2c91608079f7502592307af9e525 Reviewed-on: https://go-review.googlesource.com/c/go/+/449776 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2022-11-08math/big: remove underscores from Binomial docsEric Lagergren
Change-Id: I7605bcbbaa64bb4273ad458a157b1c6011467973 Reviewed-on: https://go-review.googlesource.com/c/go/+/447915 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-07math: fix function name in commentcui fliter
Change-Id: Iabf955cdb161d02cb4a3e06f466b331e1b6eb2c2 Signed-off-by: cui fliter <imcusg@gmail.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/447456 Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-03math/big: add PCALIGN to addMulVVW asm on ppc64xLynn Boger
Adding PCALIGN to addMulVVW assembler implementation provides the following improvement on power10: AddMulVVW/1 3.36ns ± 0% 3.37ns ± 0% +0.20% AddMulVVW/2 4.45ns ± 0% 4.44ns ± 0% -0.25% AddMulVVW/3 5.44ns ± 0% 5.49ns ± 0% +0.84% AddMulVVW/4 6.43ns ± 0% 6.34ns ± 0% -1.33% AddMulVVW/5 7.87ns ± 0% 7.73ns ± 0% -1.70% AddMulVVW/10 13.4ns ± 3% 12.4ns ± 7% -7.07% AddMulVVW/100 112ns ± 0% 102ns ± 0% -9.34% AddMulVVW/1000 1.09µs ± 0% 0.95µs ± 0% -13.15% AddMulVVW/10000 10.9µs ± 0% 9.6µs ± 0% -12.46% AddMulVVW/100000 109µs ± 0% 95µs ± 0% -12.58% Change-Id: Ic33d4f125c84d568f63e17cf99dc4df5ca9328d9 Reviewed-on: https://go-review.googlesource.com/c/go/+/447236 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Paul Murphy <murp@ibm.com> Reviewed-by: Archana Ravindar <ravindararchana@gmail.com>
2022-11-02math/big: use Montgomery for z.Exp(x, y, m) even for even mRuss Cox
Montgomery multiplication can be used for Exp mod even m by splitting it into two steps - Exp mod an odd number and Exp mod a power of two - and then combining the two results using the Chinese Remainder Theorem. For more details, see Ç. K. Koç, “Montgomery Reduction with Even Modulus”, IEE Proceedings: Computers and Digital Techniques, 141(5) 314-316, September 1994. http://www.people.vcu.edu/~jwang3/CMSC691/j34monex.pdf Thanks to Guido Vranken for suggesting that we use a faster algorithm. name old time/op new time/op delta ExpMont/Odd-16 240µs ± 2% 239µs ± 2% ~ (p=0.853 n=10+10) ExpMont/Even1-16 757µs ± 3% 249µs ± 6% -67.17% (p=0.000 n=10+10) ExpMont/Even2-16 755µs ± 1% 244µs ± 4% -67.64% (p=0.000 n=8+10) ExpMont/Even3-16 771µs ± 3% 240µs ± 2% -68.90% (p=0.000 n=10+10) ExpMont/Even4-16 775µs ± 3% 241µs ± 2% -68.91% (p=0.000 n=10+10) ExpMont/Even8-16 779µs ± 2% 241µs ± 3% -69.06% (p=0.000 n=9+10) ExpMont/Even32-16 778µs ± 3% 240µs ± 4% -69.11% (p=0.000 n=9+9) ExpMont/Even64-16 774µs ± 6% 186µs ± 2% -76.00% (p=0.000 n=10+10) ExpMont/Even96-16 776µs ± 4% 186µs ± 6% -76.09% (p=0.000 n=9+10) ExpMont/Even128-16 764µs ± 2% 143µs ± 3% -81.24% (p=0.000 n=10+10) ExpMont/Even255-16 761µs ± 3% 109µs ± 2% -85.73% (p=0.000 n=10+10) ExpMont/SmallEven1-16 45.6µs ± 1% 36.3µs ± 3% -20.49% (p=0.000 n=9+10) ExpMont/SmallEven2-16 44.3µs ± 2% 37.5µs ± 2% -15.26% (p=0.000 n=9+10) ExpMont/SmallEven3-16 44.1µs ± 5% 37.3µs ± 3% -15.32% (p=0.000 n=9+10) ExpMont/SmallEven4-16 47.1µs ± 6% 38.0µs ± 5% -19.40% (p=0.000 n=10+9) name old alloc/op new alloc/op delta ExpMont/Odd-16 2.53kB ± 0% 2.53kB ± 0% ~ (p=0.137 n=8+10) ExpMont/Even1-16 2.57kB ± 0% 3.31kB ± 0% +28.90% (p=0.000 n=8+10) ExpMont/Even2-16 2.57kB ± 0% 3.37kB ± 0% +31.09% (p=0.000 n=9+10) ExpMont/Even3-16 2.57kB ± 0% 3.37kB ± 0% +31.08% (p=0.000 n=8+8) ExpMont/Even4-16 2.57kB ± 0% 3.37kB ± 0% +31.09% (p=0.000 n=9+10) ExpMont/Even8-16 2.57kB ± 0% 3.37kB ± 0% +31.09% (p=0.000 n=9+10) ExpMont/Even32-16 2.57kB ± 0% 3.37kB ± 0% +31.14% (p=0.000 n=10+10) ExpMont/Even64-16 2.57kB ± 0% 3.16kB ± 0% +22.99% (p=0.000 n=9+9) ExpMont/Even96-16 2.57kB ± 0% 3.44kB ± 0% +33.90% (p=0.000 n=10+8) ExpMont/Even128-16 2.57kB ± 0% 2.88kB ± 0% +12.10% (p=0.000 n=10+10) ExpMont/Even255-16 2.57kB ± 0% 2.54kB ± 0% -1.30% (p=0.000 n=9+10) ExpMont/SmallEven1-16 872B ± 0% 1232B ± 0% +41.28% (p=0.000 n=10+10) ExpMont/SmallEven2-16 872B ± 0% 1233B ± 0% +41.40% (p=0.000 n=10+9) ExpMont/SmallEven3-16 872B ± 0% 1289B ± 0% +47.82% (p=0.000 n=10+10) ExpMont/SmallEven4-16 872B ± 0% 1241B ± 0% +42.32% (p=0.000 n=10+10) name old allocs/op new allocs/op delta ExpMont/Odd-16 21.0 ± 0% 21.0 ± 0% ~ (all equal) ExpMont/Even1-16 24.0 ± 0% 38.0 ± 0% +58.33% (p=0.000 n=10+10) ExpMont/Even2-16 24.0 ± 0% 40.0 ± 0% +66.67% (p=0.000 n=10+10) ExpMont/Even3-16 24.0 ± 0% 40.0 ± 0% +66.67% (p=0.000 n=10+10) ExpMont/Even4-16 24.0 ± 0% 40.0 ± 0% +66.67% (p=0.000 n=10+10) ExpMont/Even8-16 24.0 ± 0% 40.0 ± 0% +66.67% (p=0.000 n=10+10) ExpMont/Even32-16 24.0 ± 0% 40.0 ± 0% +66.67% (p=0.000 n=10+10) ExpMont/Even64-16 24.0 ± 0% 39.0 ± 0% +62.50% (p=0.000 n=10+10) ExpMont/Even96-16 24.0 ± 0% 42.0 ± 0% +75.00% (p=0.000 n=10+10) ExpMont/Even128-16 24.0 ± 0% 40.0 ± 0% +66.67% (p=0.000 n=10+10) ExpMont/Even255-16 24.0 ± 0% 38.0 ± 0% +58.33% (p=0.000 n=10+10) ExpMont/SmallEven1-16 16.0 ± 0% 35.0 ± 0% +118.75% (p=0.000 n=10+10) ExpMont/SmallEven2-16 16.0 ± 0% 35.0 ± 0% +118.75% (p=0.000 n=10+10) ExpMont/SmallEven3-16 16.0 ± 0% 37.0 ± 0% +131.25% (p=0.000 n=10+10) ExpMont/SmallEven4-16 16.0 ± 0% 36.0 ± 0% +125.00% (p=0.000 n=10+10) Change-Id: Ib7f70290f8f087b78805ec3120baf17dd7737ac3 Reviewed-on: https://go-review.googlesource.com/c/go/+/420897 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-02math/big: add benchmark of Exp with large modulusRuss Cox
Setting up for improving even modulus. name time/op ExpMont/Odd-16 240µs ± 2% ExpMont/Even1-16 757µs ± 3% ExpMont/Even2-16 755µs ± 1% ExpMont/Even3-16 771µs ± 3% ExpMont/Even4-16 775µs ± 3% ExpMont/Even8-16 779µs ± 2% ExpMont/Even32-16 778µs ± 3% ExpMont/Even64-16 774µs ± 6% ExpMont/Even96-16 776µs ± 4% ExpMont/Even128-16 764µs ± 2% ExpMont/Even255-16 761µs ± 3% ExpMont/SmallEven1-16 45.6µs ± 1% ExpMont/SmallEven2-16 44.3µs ± 2% ExpMont/SmallEven3-16 44.1µs ± 5% ExpMont/SmallEven4-16 47.1µs ± 6% name alloc/op ExpMont/Odd-16 2.53kB ± 0% ExpMont/Even1-16 2.57kB ± 0% ExpMont/Even2-16 2.57kB ± 0% ExpMont/Even3-16 2.57kB ± 0% ExpMont/Even4-16 2.57kB ± 0% ExpMont/Even8-16 2.57kB ± 0% ExpMont/Even32-16 2.57kB ± 0% ExpMont/Even64-16 2.57kB ± 0% ExpMont/Even96-16 2.57kB ± 0% ExpMont/Even128-16 2.57kB ± 0% ExpMont/Even255-16 2.57kB ± 0% ExpMont/SmallEven1-16 872B ± 0% ExpMont/SmallEven2-16 872B ± 0% ExpMont/SmallEven3-16 872B ± 0% ExpMont/SmallEven4-16 872B ± 0% name allocs/op ExpMont/Odd-16 21.0 ± 0% ExpMont/Even1-16 24.0 ± 0% ExpMont/Even2-16 24.0 ± 0% ExpMont/Even3-16 24.0 ± 0% ExpMont/Even4-16 24.0 ± 0% ExpMont/Even8-16 24.0 ± 0% ExpMont/Even32-16 24.0 ± 0% ExpMont/Even64-16 24.0 ± 0% ExpMont/Even96-16 24.0 ± 0% ExpMont/Even128-16 24.0 ± 0% ExpMont/Even255-16 24.0 ± 0% ExpMont/SmallEven1-16 16.0 ± 0% ExpMont/SmallEven2-16 16.0 ± 0% ExpMont/SmallEven3-16 16.0 ± 0% ExpMont/SmallEven4-16 16.0 ± 0% Change-Id: I5278378b4209a97b16273be581533310e0e4110b Reviewed-on: https://go-review.googlesource.com/c/go/+/420896 Reviewed-by: Roland Shoemaker <roland@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-28math/big: improve performance of BinomialRiccardo Gerosa
This change improves the performance of Binomial by implementing an algorithm that produces smaller intermediate values at each step. Working with smaller big.Int values has the advantage that fewer allocations and computations are required for each mathematical operation. The algorithm used is the Multiplicative Formula, which is a well known way of calculating the Binomial coefficient and is described at: https://en.wikipedia.org/wiki/Binomial_coefficient#Multiplicative_formula https://en.wikipedia.org/wiki/Binomial_coefficient#In_programming_languages In addition to that, an optimization has been made to remove a redundant computation of (i+1) on each loop which has a measurable impact when using big.Int. Performance improvement measured on an M1 MacBook Pro running the existing benchmark for Binomial: name old time/op new time/op delta Binomial-8 589ns ± 0% 435ns ± 0% -26.05% (p=0.000 n=10+10) name old alloc/op new alloc/op delta Binomial-8 1.02kB ± 0% 0.08kB ± 0% -92.19% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Binomial-8 38.0 ± 0% 5.0 ± 0% -86.84% (p=0.000 n=10+10) Change-Id: I5a830386dd42f062e17af88411dd74fcb110ded9 GitHub-Last-Rev: 6b2fca07de4096accb02f66c313dff47c2303462 GitHub-Pull-Request: golang/go#56339 Reviewed-on: https://go-review.googlesource.com/c/go/+/444315 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com>
2022-10-27math/rand: deprecate Readhopehook
For #20661. Change-Id: I1e638cb619e643eadc210d71f92bd1af7bafc912 Reviewed-on: https://go-review.googlesource.com/c/go/+/436955 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: hopehook <hopehook@golangcn.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-10-26all: remove uses of rand.SeedRuss Cox
As of CL 443058, rand.Seed is not necessary to call, nor is it a particular good idea. For #54880. Change-Id: If9d70763622c09008599db8c97a90fcbe285c6f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/445395 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-25math/rand: auto-seed global sourceRuss Cox
Implement proposal #54880, to automatically seed the global source. The justification for this not being a breaking change is that any use of the global source in a package's init function or exported API clearly must be valid - that is, if a package changes how much randomness it consumes at init time or in an exported API, that clearly isn't the kind of breaking change that requires issuing a v2 of that package. That kind of per-package change in the position of the global source is indistinguishable from seeding the global source differently. So if the per-package change is valid, so is auto-seeding. And then, of course, auto-seeding means that packages will be far less likely to depend on the specific results of the global source and therefore not break when those kinds of per-package changes happen in the future. Seed(1) can be called in programs that need the old sequence from the global source and want to restore the old behavior. Of course, those programs will still be broken by the per-package changes just described, and it would be better for them to allocate local sources rather than continue to use the global one. Fixes #54880. Change-Id: Ib9dc3307b97f7a45587a9cc50d81f919d3edc7ae Reviewed-on: https://go-review.googlesource.com/c/go/+/443058 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org>
2022-10-21math/bits: note that functions here may be compiler intrinsicsNick Craig-Wood
It was noted in the go1.9 release notes that functions in math/bits may be implemented by compiler intrinsics, but this never made it to the documentation. This change adapts the wording of the release notes and puts it in the documentation for math/bits. Change-Id: Ibeea88eaf7df10952cbe670885e910ac30b49d55 Reviewed-on: https://go-review.googlesource.com/c/go/+/444035 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-10-18math/rand: refactor to delay allocation of global sourceRuss Cox
This sets up for delaying the decision of which seed to use, but this CL still keeps the original global Seed(1) semantics. Preparation for #54880. Change-Id: Ibfa9d50ec9023aa755a83852e55168fa7d24b115 Reviewed-on: https://go-review.googlesource.com/c/go/+/443057 Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
2022-10-11math/big: error on buffer length overflow in Rat.GobDecodeIan Lance Taylor
Fixes #56156 Change-Id: Ib85ff45f0b0d0eac83c39606ee20b3a312e6e919 Reviewed-on: https://go-review.googlesource.com/c/go/+/442335 Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-01math: optimize Hypot functioneric fang
This CL optimizes the Hypot function by putting the Abs function in front of the IsInf check. This simplifies the judgment of IsInf. Benchmarks: On linux/arm64, name old time/op new time/op delta Hypot-160 5.26ns ± 0% 4.53ns ± 0% -13.84% (p=0.000 n=4+5) HypotGo-160 5.19ns ± 0% 4.85ns ± 0% -6.53% (p=0.008 n=5+5) On linux/amd64, name old time/op new time/op delta Hypot-44 5.99ns ± 0% 5.99ns ± 0% ~ (p=0.667 n=5+5) HypotGo-44 7.46ns ± 0% 6.61ns ± 0% -11.37% (p=0.008 n=5+5) On darwin/arm64, name old time/op new time/op delta Hypot-8 3.58ns ± 0% 2.79ns ± 0% -22.01% (p=0.008 n=5+5) HypotGo-8 3.58ns ± 0% 2.79ns ± 0% -22.15% (p=0.008 n=5+5) Change-Id: Id79236e01d9494b6e00bbda3ec08c72caf5ef3c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/414974 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Eric Fang <eric.fang@arm.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-21math: show value of integer constants in commentsShulhan
Fixes #51282 Change-Id: I5b0d68165b727a427bd4a42663b2fa0070ced22f Reviewed-on: https://go-review.googlesource.com/c/go/+/343990 Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06math/big: replace dead link in a comment with link to an archive.org copyAlok Menghrajani
Happy to use another service if web.archive.org isn't suitable. Note: the original page redirects and then links to some nsfw content. Change-Id: Ie93ca0c6aad871881f35b7e5609b96da5c14cfc0 GitHub-Last-Rev: ced5a97eb5c1d954a04d4bb61d36d955ca45a6ab GitHub-Pull-Request: golang/go#54857 Reviewed-on: https://go-review.googlesource.com/c/go/+/428236 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@google.com>
2022-09-02math/rand: document that Source returned by NewSource implements Source64Jonathan FOng
Fixes #44488 Change-Id: I570950799788678b9dc6e9ddad894973b4611e09 Reviewed-on: https://go-review.googlesource.com/c/go/+/425974 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: David Chase <drchase@google.com>
2022-08-15cmd/compile,math: remove all sqrt assembly codeWayne Zuo
This CL make math.sqrt an intrinsic function, math.Sqrt is not affected since compiler can inline it. With this change, we can remove all assembly code for math.Sqrt that aims to speed up indirect call. The go compiler can generate same or faster code (with regabi) for indirect call. Benchmark on amd64: name old time/op new time/op delta SqrtIndirect 2.60ns ± 3% 1.03ns ± 4% -60.24% (p=0.000 n=10+10) SqrtLatency 3.40ns ± 1% 3.32ns ± 1% -2.26% (p=0.000 n=10+8) SqrtIndirectLatency 6.09ns ± 0% 3.31ns ± 0% -45.67% (p=0.000 n=10+10) SqrtGoLatency 36.1ns ± 6% 34.6ns ± 1% ~ (p=0.101 n=10+10) SqrtPrime 2.53µs ± 2% 2.55µs ± 6% ~ (p=0.398 n=9+9) Change-Id: If4be0f242c1d9d4feca7d269fc9cd6e6066f163d Reviewed-on: https://go-review.googlesource.com/c/go/+/421074 Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09internal/testenv: add and use OptimizationOff/SkipIfOptimizationOffCuong Manh Le
So we don't have to duplicate the logic to detect noopt builder in multiple places. Based on khr@'s suggestion in CL 422037. Change-Id: Idb338e8bc08cdf00460574bfc0d2f7018c79bbd5 Reviewed-on: https://go-review.googlesource.com/c/go/+/422038 Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-08-08math/big: disable TestNewIntAllocs on noopt builderCuong Manh Le
Since when that test requires inlining, which is disabled on noopt builder. Updates #29951 Change-Id: I9d7a0a64015a30d3bfb5ad5d806ea0955657fda3 Reviewed-on: https://go-review.googlesource.com/c/go/+/422039 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-08-08math/big: make NewInt inlineable and zero allocationKeith Randall
Mark the assembly routines as not escaping their arguments. Add a special case to NewInt that, when inlined, can do all of its allocations (a big.Int and a [1]Word) on the stack. Update #29951 Change-Id: I9bd38c262eb97df98c0ed9874da7daac381243ea Reviewed-on: https://go-review.googlesource.com/c/go/+/411254 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2022-07-27math/big: check buffer lengths in GobDecodeRoland Shoemaker
In Float.GobDecode and Rat.GobDecode, check buffer sizes before indexing slices. Fixes #53871 Change-Id: I1b652c32c2bc7a0e8aa7620f7be9b2740c568b0a Reviewed-on: https://go-review.googlesource.com/c/go/+/417774 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Tatiana Bradley <tatiana@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org>
2022-05-20go, math, os, reflect: support standard library for loong64Xiaodong Liu
Contributors to the loong64 port are: Weining Lu <luweining@loongson.cn> Lei Wang <wanglei@loongson.cn> Lingqin Gong <gonglingqin@loongson.cn> Xiaolin Zhao <zhaoxiaolin@loongson.cn> Meidan Li <limeidan@loongson.cn> Xiaojuan Zhai <zhaixiaojuan@loongson.cn> Qiyuan Pu <puqiyuan@loongson.cn> Guoqi Chen <chenguoqi@loongson.cn> This port has been updated to Go 1.15.6: https://github.com/loongson/go Updates #46229 Change-Id: I2ad9ed01fc913b90e75023ac0fa70de87a9f5de1 Reviewed-on: https://go-review.googlesource.com/c/go/+/342324 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-05-19all: gofmt main repoRuss Cox
Excluding vendor and testdata. CL 384268 already reformatted most, but these slipped past. The struct in the doc comment in debug/dwarf/type.go was fixed up by hand to indent the first and last lines as well. For #51082. Change-Id: Iad020f83aafd671ff58238fe491907e85923d0c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/407137 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-05-08all: fix some lint issuesRyan Leung
Make some code more simple. Change-Id: I801adf0dba5f6c515681345c732dbb907f945419 GitHub-Last-Rev: a505146baca00a1b3268d11d10510afa8cea6f1d GitHub-Pull-Request: golang/go#49626 Reviewed-on: https://go-review.googlesource.com/c/go/+/364634 Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2022-05-08math/big: don't force second arg to Jacobi and Int.ModSqrt to escapeNathan VanBenschoten
This CL updates big.Jacobi to avoid forcing its y argument to escape to the heap. The argument was escaping because it was being passed through an empty interface to fmt.Sprintf during an assertion failure. As a result, callers of Jacobi and Int.ModSqrt (which calls Jacobi) could not keep this value on the stack. Noticed when working on https://github.com/cockroachdb/apd/pull/103. Change-Id: I5db9ee2149bf13b921886929425861721b53b085 GitHub-Last-Rev: 3ee07b5dc3292553cc0cd0eb2d38ef036c341a9d GitHub-Pull-Request: golang/go#50527 Reviewed-on: https://go-review.googlesource.com/c/go/+/377014 Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org>
2022-05-02all: REVERSE MERGE dev.boringcrypto (cdcb4b6) into masterRuss Cox
This commit is a REVERSE MERGE. It merges dev.boringcrypto back into its parent branch, master. This marks the end of development on dev.boringcrypto. Manual Changes: - git rm README.boringcrypto.md - git rm -r misc/boring - git rm src/cmd/internal/notsha256/sha256block_arm64.s - git cherry-pick -n 5856aa74 # remove GOEXPERIMENT=boringcrypto forcing in cmd/dist There are some minor cleanups like merging import statements that I will apply in a follow-up CL. Merge List: + 2022-04-29 cdcb4b6ef3 [dev.boringcrypto] cmd/compile: remove the awful boringcrypto kludge + 2022-04-29 e845f572ec [dev.boringcrypto] crypto/ecdsa, crypto/rsa: use boring.Cache + 2022-04-29 a840bf871e [dev.boringcrypto] crypto/internal/boring: add GC-aware cache + 2022-04-29 0184fe5ece [dev.boringcrypto] crypto/x509: remove VerifyOptions.IsBoring + 2022-04-29 9e9c7a0aec [dev.boringcrypto] crypto/..., go/build: align deps test with standard rules + 2022-04-29 0ec08283c8 [dev.boringcrypto] crypto/internal/boring: make SHA calls allocation-free + 2022-04-29 3cb10d14b7 [dev.boringcrypto] crypto/internal/boring: avoid allocation in big.Int conversion + 2022-04-29 509776be5d [dev.boringcrypto] cmd/dist: default to use of boringcrypto + 2022-04-29 f4c0f42f99 [dev.boringcrypto] all: add boringcrypto build tags + 2022-04-29 1f0547c4ec [dev.boringcrypto] cmd/go: pass dependency syso to cgo too + 2022-04-29 e5407501cb [dev.boringcrypto] cmd: use notsha256 instead of md5, sha1, sha256 + 2022-04-29 fe006d6410 [dev.boringcrypto] cmd/internal/notsha256: add new package + 2022-04-27 ec7f5165dd [dev.boringcrypto] all: merge master into dev.boringcrypto + 2022-04-22 ca6fd39cf6 [dev.boringcrypto] misc/boring: skip long tests during build.release + 2022-04-21 19e4b10f2f [dev.boringcrypto] all: merge master into dev.boringcrypto + 2022-04-20 e07d63964b [dev.boringcrypto] all: merge master into dev.boringcrypto + 2022-04-13 1f11660f54 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2022-04-13 bc3e5d0ab7 [dev.boringcrypto] misc/boring: remove -trust and individual reviewers + 2022-04-05 4739b353bb [dev.boringcrypto] all: merge master into dev.boringcrypto + 2022-03-30 9d6ab825f6 [dev.boringcrypto] make.bash: disable GOEXPERIMENT when using bootstrap toolchain + 2022-03-30 d1405d7410 [dev.boringcrypto] crypto/internal/boring: update build instructions to use podman + 2022-03-29 50b8f490e1 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2022-03-15 0af0e19368 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2022-03-07 f492793839 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2022-03-07 768804dfdd [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2022-02-11 8521d1ea34 [dev.boringcrypto] misc/boring: use go install cmd@latest for installing command + 2022-02-11 b75258fdd8 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2022-02-08 74d25c624c [dev.boringcrypto] all: merge master into dev.boringcrypto + 2022-02-03 e14fee553a [dev.boringcrypto] all: merge master into dev.boringcrypto + 2022-01-14 d382493a20 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-12-09 069bbf5434 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-12-06 21fa0b2199 [dev.boringcrypto] crypto/internal/boring: add -pthread linker flag + 2021-12-03 a38b43e4ab [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-11-09 16215e5340 [dev.boringcrypto] cmd/compile: disable version test on boringcrypto + 2021-11-08 c9858c7bdc [dev.boringcrypto] all: merge master into dev.boringcrypto + 2021-11-05 ed07c49cb6 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2021-11-05 dc2658558d [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-10-28 69d5e469a4 [dev.boringcrypto] all: convert +build to //go:build lines in boring-specific files + 2021-10-08 2840ccbc05 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-10-08 114aa69932 [dev.boringcrypto] misc/boring: fix Docker Hub references + 2021-10-08 7d26add6d5 [dev.boringcrypto] misc/boring: publish to Artifact Registry + 2021-08-27 5ae200d526 [dev.boringcrypto] crypto/tls: permit P-521 in FIPS mode + 2021-08-26 083811d079 [dev.boringcrypto] crypto/tls: use correct config in TestBoringClientHello + 2021-08-16 c7e7ce5ec1 [dev.boringcrypto] all: merge commit 57c115e1 into dev.boringcrypto + 2021-08-10 1fb58d6cad [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-07-14 934db9f0d6 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-06-08 a890a4de30 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-05-13 ed1f812cef [dev.boringcrypto] all: merge commit 9d0819b27c (CL 314609) into dev.boringcrypto + 2021-05-10 ad1b6f3ee0 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-04-21 11061407d6 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-03-23 b397e0c028 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-03-15 128cecc70b [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-03-10 5e2f5a38c4 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-02-26 42089e72fd [dev.boringcrypto] api: add crypto/boring.Enabled + 2021-02-24 03cd666173 [dev.boringcrypto] all: merge master (5b76343) into dev.boringcrypto + 2021-02-17 0f210b75f9 [dev.boringcrypto] all: merge master (2f0da6d) into dev.boringcrypto + 2021-02-12 1aea1b199f [dev.boringcrypto] misc/boring: support codereview.cfg in merge.sh + 2021-02-07 0d34d85dee [dev.boringcrypto] crypto/internal/boring: remove .llvm_addrsig section + 2021-02-07 325e03a64f [dev.boringcrypto] all: add codereview.cfg + 2021-02-05 d4f73546c8 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-01-20 cf8ed7cca4 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2021-01-20 f22137d785 [dev.boringcrypto] misc/boring: add -trust and roland@ to merge.sh and release.sh + 2020-12-12 e5c7bd0efa [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-12-02 5934c434c1 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-12-01 dea96ada17 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-11-18 906d6e362b [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-11-18 95ceba18d3 [dev.boringcrypto] crypto/hmac: merge up to 2a206c7 and skip test + 2020-11-17 0985c1bd2d [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-11-16 af814af6e7 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-11-05 f42bd50779 [dev.boringcrypto] crypto/internal/boring: update BoringCrypto module to certificate 3678 + 2020-10-19 ceda58bfd0 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-09-29 af85c47233 [dev.boringcrypto] misc/boring: bump version to b6 + 2020-09-29 f9b86a6562 [dev.boringcrypto] go/build: satisfy the boringcrypto build tag + 2020-09-29 ef2b318974 [dev.boringcrypto] crypto/boring: expose boring.Enabled() + 2020-09-14 3782421230 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-08-18 6bbe47ccb6 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-07-21 6e6e0b73d6 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-07-09 d85ef2b979 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-07-09 a91ad4250c [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-06-10 5beb39baf8 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-05-07 dd98c0ca3f [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-05-07 a9d2e3abf7 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-05-07 c19c0a047b [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-05-07 36c94f8421 [dev.boringcrypto] crypto/internal/boring: reject short signatures in VerifyRSAPKCS1v15 + 2020-05-07 ee159d2f35 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-04-08 e067ce5225 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2020-03-03 79284c2873 [dev.boringcrypto] crypto/internal/boring: make accesses to RSA types with finalizers safer + 2020-03-02 6c64b188a5 [dev.boringcrypto] crypto/internal/boring: update BoringCrypto module to certificate 3318 + 2020-02-28 13355c78ff [dev.boringcrypto] misc/boring: add go1.14b4 to RELEASES file + 2020-02-28 4980c6b317 [dev.boringcrypto] misc/boring: x/build/cmd/release doesn't take subrepo flags anymore + 2020-02-28 601da81916 [dev.boringcrypto] misc/boring: make merge.sh and release.sh a little more robust + 2020-02-14 09bc5e8723 [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2020-02-06 f96dfe6b73 [dev.boringcrypto] misc/boring: add go1.13.7b4 and go1.12.16b4 releases to RELEASES file + 2020-02-05 2f9b2e75c4 [dev.boringcrypto] misc/docker: update Dockerfile to match recent Buster based golang images + 2020-02-05 527880d05c [dev.boringcrypto] misc/boring: update default CL reviewer to katie@golang.org + 2019-11-25 50ada481fb [dev.boringcrypto] misc/boring: add new releases to RELEASES file + 2019-11-20 6657395adf [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-11-20 ab0a649d44 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-11-19 62ce702c77 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-10-25 e8f14494a0 [dev.boringcrypto] misc/boring: add go1.13.3b4 and go1.12.12b4 to RELEASES file + 2019-10-17 988e4d832e [dev.boringcrypto] misc/boring: add go1.13.2b4 and go1.12.11b4 to RELEASES file + 2019-10-11 974fd1301a [dev.boringcrypto] misc/boring: publish to Docker Hub all releases, not only the latest + 2019-09-27 62ce8cd3ad [dev.boringcrypto] misc/boring: add go1.13.1b4 and go1.12.10b4 to RELEASES file + 2019-09-10 489d268683 [dev.boringcrypto] misc/boring: add Go+BoringCrypto 1.13b4 to RELEASES file + 2019-09-04 e0ee09095c [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-09-03 ff197f326f [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-08-21 5a1705286e [dev.boringcrypto] misc/boring: add go1.12.9b4 to RELEASES + 2019-08-15 1ebc594b3c [dev.boringcrypto] misc/boring: add go1.12.8b4 and go1.11.13b4 to RELEASES + 2019-08-13 9417029290 [dev.boringcrypto] misc/boring: remove download of releaselet.go in build.release + 2019-08-05 2691091a4a misc/boring: add Go 1.11.12b4 and 1.12.7b4 to RELEASES + 2019-07-19 6eccf6a6cd [dev.boringcrypto] misc/boring: add scripts to automate merges and releases + 2019-06-27 98188f3001 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-06-13 5c354e66d1 [dev.boringcrypto] misc/boring: add go1.12.6b4 and go1.11.11b4 releases + 2019-06-09 9bf9e7d4b2 [dev.boringcrypto] crypto: move crypto/internal/boring imports to reduce merge conflicts + 2019-06-05 324f8365be [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-05-28 e48f228c9b [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-05-14 42e353245c [dev.boringcrypto] misc/boring: add go1.12.5b4 release + 2019-03-29 211a13fd44 [dev.boringcrypto] misc/boring: add go1.11.6b4 to RELEASES + 2019-03-28 347af7f060 [dev.boringcrypto] misc/boring: add go1.12.1b4 and update build scripts + 2019-02-27 a10558f870 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-02-08 4ed8ad4d69 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2019-01-24 14c64dbc4a [dev.boringcrypto] misc/boring: add go1.10.8b4 and go1.11.5b4 + 2018-12-15 3f9e53f346 [dev.boringcrypto] misc/boring: add go1.10.7b4 and go1.11.4b4 releases + 2018-12-14 92d975e906 [dev.boringcrypto] misc/boring: add go1.11.2b4 release + 2018-11-14 c524da4917 [dev.boringcrypto] crypto/tls: test for TLS 1.3 to be disabled in FIPS mode + 2018-11-14 bfd6d30118 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-11-14 0007017f96 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-11-14 3169778c15 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-11-14 ab37582eb0 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-11-14 e8b3500d5c [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-11-14 de153ac2a1 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-11-14 0cbb11c720 [dev.boringcrypto] cmd/compile: by default accept any language + 2018-11-13 11e916773e [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-11-13 af07f7734b [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-10-25 13bf5b80e8 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-10-15 623650b27a [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-10-01 36c789b1fd [dev.boringcrypto] misc/boring: add go1.10.4b4 and go1.11b4 releases + 2018-09-07 693875e3f2 [dev.boringcrypto] crypto/internal/boring: avoid an allocation in AES-GCM Seal and Open + 2018-09-06 4d1aa482b8 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-08-04 7eb1677c01 [dev.boringcrypto] crypto/internal/boring: fix aesCipher implementation of gcmAble + 2018-07-11 eaa3e94eb8 [dev.boringcrypto] misc/boring: add go1.9.7b4 and go1.10.3b4 releases + 2018-07-11 5f0402a26b [dev.boringcrypto] misc/boring: support build.release on macOS + 2018-07-03 77db076129 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-06-13 b77f5e4c85 [dev.boringcrypto] crypto/rsa: drop random source reading emulation + 2018-06-08 a4b7722ffa [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-05-29 18db93d7e6 [dev.boringcrypto] crypto/tls: restore AES-GCM priority when BoringCrypto is enabled + 2018-05-25 3d9a6ac709 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-05-18 019a994e32 [dev.boringcrypto] crypto/rsa: fix boringFakeRandomBlind to work with (*big.Int).ModInverse + 2018-05-17 a3f9ce3313 [dev.boringcrypto] all: merge master into dev.boringcrypto + 2018-02-09 528dad8c72 [dev.cryptoboring] misc/boring: update README for Bazel + 2018-02-06 c3d83ee31c [dev.boringcrypto] misc/boring: add go1.9.3b4 to RELEASES + 2017-12-13 f62a24349d [dev.boringcrypto] all: merge go1.10beta1 into dev.boringcrypto + 2017-12-06 3e52f22ece [dev.boringcrypto] crypto/internal/boring: add MarshalBinary/UnmarshalBinary to hashes + 2017-12-06 5379f7847f [dev.boringcrypto] all: merge master (more nearly Go 1.10 beta 1) into dev.boringcrypto + 2017-12-06 185e6094fd [dev.boringcrypto] all: merge master (nearly Go 1.10 beta 1) into dev.boringcrypto + 2017-11-20 c36033a379 [dev.boringcrypto] misc/boring: add go1.9.2b4 release + 2017-11-20 cda3c6f91d [dev.boringcrypto] all: merge go1.9.2 into dev.boringcrypto + 2017-10-25 2ea7d3461b [release-branch.go1.9] go1.9.2 + 2017-10-25 d93cb46280 [release-branch.go1.9] runtime: use simple, more robust fastrandn + 2017-10-25 78952c06c5 [release-branch.go1.9] cmd/compile: fix sign-extension merging rules + 2017-10-25 79996e4a1d [release-branch.go1.9] cmd/compile: avoid generating large offsets + 2017-10-25 f36b12657c [release-branch.go1.9] runtime: in cpuProfile.addExtra, set p.lostExtra to 0 after flush + 2017-10-25 dffc9319f1 [release-branch.go1.9] cmd/cgo: support large unsigned macro again + 2017-10-25 33ce1682c7 [release-branch.go1.9] cmd/cgo: avoid using common names for sniffing + 2017-10-25 f69668e1d0 [release-branch.go1.9] os: skip TestPipeThreads as flaky for 1.9 + 2017-10-25 9be38a15e4 [release-branch.go1.9] runtime: avoid monotonic time zero on systems with low-res timers + 2017-10-25 8bb333a9c0 [release-branch.go1.9] doc: document Go 1.9.2 + 2017-10-25 0758d2b9da [release-branch.go1.9] cmd/go: clean up x.exe properly in TestImportMain + 2017-10-25 d487b15a61 [release-branch.go1.9] cmd/compile: omit ICE diagnostics after normal error messages + 2017-10-25 fd17253587 [release-branch.go1.9] database/sql: prevent race in driver by locking dc in Next + 2017-10-25 7e7cb30475 [release-branch.go1.9] internal/poll: only call SetFileCompletionNotificationModes for sockets + 2017-10-25 f259aed082 [release-branch.go1.9] internal/poll: do not call SetFileCompletionNotificationModes if it is broken + 2017-10-25 39d4bb9c0f [release-branch.go1.9] cmd/go: correct directory used in checkNestedVCS test + 2017-10-25 bfc22319aa [release-branch.go1.9] crypto/x509: reject intermediates with unknown critical extensions. + 2017-10-25 a1e34abfb3 [release-branch.go1.9] net/smtp: NewClient: set tls field to true when already using a TLS connection + 2017-10-25 7dadd8d517 [release-branch.go1.9] net: increase expected time to dial a closed port on all Darwin ports + 2017-10-25 d80889341c [release-branch.go1.9] cmd/compile: fix merge rules for panic calls + 2017-10-25 87b3a27839 [release-branch.go1.9] net: bump TestDialerDualStackFDLeak timeout on iOS + 2017-10-25 ebfcdef901 [release-branch.go1.9] runtime: make runtime.GC() trigger GC even if GOGC=off + 2017-10-25 0ab99b396d [release-branch.go1.9] cmd/compile: fix regression in PPC64.rules move zero + 2017-10-25 8d4279c111 [release-branch.go1.9] internal/poll: be explicit when using runtime netpoller + 2017-10-25 1ded8334f7 [release-branch.go1.9] cmd/compile/internal/syntax: fix source buffer refilling + 2017-10-25 ff8289f879 [release-branch.go1.9] reflect: fix pointer past-the-end in Call with zero-sized return value + 2017-10-25 bd34e74134 [release-branch.go1.9] log: fix data race on log.Output + 2017-10-25 0b55d8dbfc [release-branch.go1.9] cmd/compile: replace GOROOT in //line directives + 2017-10-25 5c48811aec [release-branch.go1.9] cmd/compile: limit the number of simultaneously opened files to avoid EMFILE/ENFILE errors + 2017-10-25 8c7fa95ad3 [release-branch.go1.9] expvar: make (*Map).Init clear existing keys + 2017-10-25 ccd5abc105 [release-branch.go1.9] cmd/compile: simplify "missing function body" error message + 2017-10-25 2e4358c960 [release-branch.go1.9] time: fix documentation of Round, Truncate behavior for d <= 0 + 2017-10-25 c6388d381e [release-branch.go1.9] runtime: capture runtimeInitTime after nanotime is initialized + 2017-10-25 724638c9d8 [release-branch.go1.9] crypto/x509: skip TestSystemRoots + 2017-10-25 ed3b0d63b7 [release-branch.go1.9] internal/poll: add tests for Windows file and serial ports + 2017-10-04 93322a5b3d [release-branch.go1.9] doc: add missing "Minor revisions" header for 1.9 + 2017-10-04 7f40c1214d [release-branch.go1.9] go1.9.1 + 2017-10-04 598433b17a [release-branch.go1.9] doc: document go1.9.1 and go1.8.4 + 2017-10-04 815cad3ed0 [release-branch.go1.9] doc/1.9: add mention of net/http.LocalAddrContextKey + 2017-10-04 1900d34a10 [release-branch.go1.9] net/smtp: fix PlainAuth to refuse to send passwords to non-TLS servers + 2017-10-04 a39bcecea6 [release-branch.go1.9] cmd/go: reject update of VCS inside VCS + 2017-10-04 d9e64910af [release-branch.go1.9] runtime: deflake TestPeriodicGC + 2017-09-28 adc1f587ac [dev.boringcrypto] misc/boring: add src releases + 2017-09-25 4038503543 [dev.boringcrypto] misc/boring: add go1.8.3b4 + 2017-09-25 d724c60b4d [dev.boringcrypto] misc/boring: update README + 2017-09-22 70bada9db3 [dev.boringcrypto] misc/boring: add go1.9b4 release + 2017-09-22 e6ad24cde7 [dev.boringcrypto] all: merge go1.9 into dev.boringcrypto + 2017-09-22 431e071eed [dev.boringcrypto] misc/boring: add go1.9rc2b4 release + 2017-09-22 cc6e26b2e1 [dev.boringcrypto] api: add crypto/x509.VerifyOptions.IsBoring to make release builder happy + 2017-09-22 bac02b14b5 [dev.boringcrypto] misc/boring: update VERSION + 2017-09-22 3ed08db261 [dev.boringcrypto] crypto/tls/fipsonly: new package to force FIPS-allowed TLS settings + 2017-09-20 2ba76155cd [dev.boringcrypto] crypto/internal/boring: fix finalizer-induced crashes + 2017-09-18 32dc9b247f [dev.boringcrypto] cmd/go: exclude SysoFiles when using -msan + 2017-09-18 9f025cbdeb [dev.boringcrypto] crypto/internal/boring: fall back to standard crypto when using -msan + 2017-09-18 89ba9e3541 [dev.boringcrypto] crypto/aes: panic on invalid dst, src overlap + 2017-09-18 a929f3a04d [dev.boringcrypto] crypto/rsa: fix boring GenerateKey to set non-nil Precomputed.CRTValues + 2017-09-18 aa4a4a80ff [dev.boringcrypto] crypto/internal/boring: fix detection of tests to allow *.test and *_test + 2017-09-18 c9e2d9eb06 [dev.boringcrypto] crypto/rsa: add test for, fix observable reads from custom randomness + 2017-09-18 e773ea9aa3 [dev.boringcrypto] crypto/hmac: add test for Write/Sum after Sum + 2017-09-18 8fa8f42cb3 [dev.boringcrypto] crypto/internal/boring: allow hmac operations after Sum + 2017-09-18 07f6ce9d39 [dev.boringcrypto] crypto/internal/boring: handle RSA verification of short signatures + 2017-09-14 e8eec3fbdb [dev.boringcrypto] cmd/compile: refine BoringCrypto kludge + 2017-08-30 7b49445d0f [dev.boringcrypto] cmd/compile: hide new boring fields from reflection + 2017-08-30 81b9d733b0 [dev.boringcrypto] crypto/hmac: test empty key + 2017-08-30 f6358bdb6c [dev.boringcrypto] crypto/internal/boring: fix NewHMAC with empty key + 2017-08-30 9c307d8039 [dev.boringcrypto] crypto/internal/cipherhw: fix AESGCMSupport for BoringCrypto + 2017-08-26 f48a9fb815 [dev.boringcrypto] misc/boring: release packaging + 2017-08-25 94fb8224b2 [dev.boringcrypto] crypto/internal/boring: disable for android & non-cgo builds + 2017-08-25 7ff9fcafbd [dev.boringcrypto] crypto/internal/boring: clear "executable stack" bit from syso + 2017-08-24 c8aec4095e [release-branch.go1.9] go1.9 + 2017-08-24 b8c9ef9f09 [release-branch.go1.9] doc: add go1.9 to golang.org/project + 2017-08-24 136f4a6b2a [release-branch.go1.9] doc: document go1.9 + 2017-08-24 867be4c60c [release-branch.go1.9] doc/go1.9: fix typo in Moved GOROOT + 2017-08-24 d1351fbc31 [dev.boringcrypto] cmd/link: allow internal linking for crypto/internal/boring + 2017-08-24 991652dcf0 [dev.boringcrypto] cmd/link: work around DWARF symbol bug + 2017-08-22 9a4e7942ea [release-branch.go1.9] cmd/compile: remove gc.Sysfunc calls from 387 backend + 2017-08-22 ff38035a62 [release-branch.go1.9] doc/go1.9: fix typo in crypto/x509 of "Minor changes to the library". + 2017-08-19 7e9e3a06cb [dev.boringcrypto] crypto/rsa: use BoringCrypto + 2017-08-19 bc38fda367 [dev.boringcrypto] crypto/ecdsa: use unsafe.Pointer instead of atomic.Value + 2017-08-18 42046e8989 [release-branch.go1.9] runtime: fix false positive race in profile label reading + 2017-08-18 fbf7e1f295 [release-branch.go1.9] testing: don't fail all tests after racy test failure + 2017-08-18 21312a4b5e [release-branch.go1.9] cmd/dist: update deps.go for current dependencies + 2017-08-18 5927854f7d [release-branch.go1.9] cmd/compile: add rules handling unsigned div/mod by constant 1<<63 + 2017-08-18 65717b2dca [release-branch.go1.9] runtime: fix usleep by correctly setting nanoseconds parameter for pselect6 + 2017-08-17 b1f201e951 [dev.boringcrypto] crypto/ecdsa: use BoringCrypto + 2017-08-17 2efded1cd2 [dev.boringcrypto] crypto/tls: use TLS-specific AES-GCM mode if available + 2017-08-17 335a0f87bf [dev.boringcrypto] crypto/aes: implement TLS-specific AES-GCM mode from BoringCrypto + 2017-08-17 8d05ec9e58 [dev.boringcrypto] crypto/aes: use BoringCrypto + 2017-08-17 74e33c43e9 [dev.boringcrypto] crypto/hmac: use BoringCrypto + 2017-08-17 96d6718e4f [dev.boringcrypto] crypto/sha1,sha256,sha512: use BoringCrypto + 2017-08-17 e0e2bbdd00 [dev.boringcrypto] runtime/race: move TestRaceIssue5567 from sha1 to crc32 + 2017-08-17 fe02ba30f1 [dev.boringcrypto] crypto/rand: use BoringCrypto + 2017-08-17 6e70f88f84 [dev.boringcrypto] crypto/internal/boring: add initial BoringCrypto access + 2017-08-16 dcdcc38440 [dev.boringcrypto] add README.boringcrypto.md, update VERSION + 2017-08-16 19b89a22df [dev.boringcrypto] cmd/link: implement R_X86_64_PC64 relocations + 2017-08-07 048c9cfaac [release-branch.go1.9] go1.9rc2 + 2017-08-07 cff0de3da3 [release-branch.go1.9] all: merge master into release-branch.go1.9 + 2017-07-31 196492a299 [release-branch.go1.9] runtime: map bitmap and spans during heap initialization + 2017-07-31 1a6d87d4bf [release-branch.go1.9] runtime: fall back to small mmaps if we fail to grow reservation + 2017-07-27 7320506bc5 [release-branch.go1.9] cmd/dist: skip moved GOROOT on Go's Windows builders when not sharding tests + 2017-07-24 65c6c88a94 [release-branch.go1.9] go1.9rc1 + 2017-07-24 fbc9b49790 [release-branch.go1.9] cmd/compile: consider exported flag in namedata Change-Id: I5344e8e4813a9a0900f6633499a3ddf22895a4d5
2022-04-28math/big: delete all mulWW assembly codeWayne Zuo
Now gc can generate the same assembly code. Change-Id: Iac503003e14045d63e2def66408c13cee516aa37 Reviewed-on: https://go-review.googlesource.com/c/go/+/402575 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2022-04-27math/big: add comprehensive aliasing tests (and minor fixes to Exp, Rand)Filippo Valsorda
TestAlias checks systematically for aliasing issues, where passing the same value for an argument and the receiver leads to incorrect results. We had a number of issues like that over the years: - #31084: Lsh on arm64 - #30217: GCD - #22830: Exp due to divLarge - #22265: ModSqrt - #20490: Add and Sub - #11284: GCD This CL also fixes two new minor bugs that the test found. A wrong result would be returned by - Exp when the modulo and the receiver alias - Rand when the limit is negative and it aliases the receiver The test runs in ~0.05s with the default -quickchecks value. Change-Id: I8354069ec9886e40c60f2642342ee08e604befb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/168257 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Filippo Valsorda <valsorda@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org>
2022-04-20[dev.boringcrypto] all: merge master into dev.boringcryptoChressie Himpel
Change-Id: I52009bf809dda4fbcff03aa82d0ea8aa2a978fa2
2022-04-14math: improve documentation of CopysignJoe Tsai
Name the arguments in a way that is more self-describing. Many code editor tools show a snippet of the function and its arguments. However, "x" and "y" are not helpful in determining which is the sign and which is the magnitude, short of reading the documentation itself. Name the sign argument as "sign" to be explicit. This follows the same naming convention as IsInf. Change-Id: Ie3055009e475f96c92d5ea7bfe9828eed908c78b Reviewed-on: https://go-review.googlesource.com/c/go/+/400177 Run-TryBot: Joseph Tsai <joetsai@digital-static.net> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-04-12math/big: Implement shlVU and shrVU in ASM for PPC64Archana R
Currently the shift left and shift right functions are coded in .go on PPC64. Implementing them in ASM just like AMD and ARM results in overall speedup of shift benchmarks on POWER8/9/10. name old time/op new time/op delta NonZeroShifts/1/shrVU 8.50ns ± 0% 5.21ns ± 0% -38.66% NonZeroShifts/1/shlVU 8.85ns ± 1% 5.24ns ± 0% -40.78% NonZeroShifts/2/shrVU 9.16ns ± 0% 5.51ns ± 0% -39.80% NonZeroShifts/2/shlVU 9.24ns ± 2% 5.61ns ± 0% -39.28% NonZeroShifts/3/shrVU 10.6ns ± 0% 6.8ns ± 0% -35.78% NonZeroShifts/3/shlVU 10.7ns ± 2% 6.4ns ± 0% -40.82% NonZeroShifts/4/shrVU 12.4ns ± 0% 7.7ns ± 0% -38.12% NonZeroShifts/4/shlVU 12.3ns ± 1% 7.5ns ± 0% -38.67% NonZeroShifts/5/shrVU 13.2ns ± 0% 8.5ns ± 0% -35.51% NonZeroShifts/5/shlVU 13.3ns ± 2% 9.3ns ± 0% -30.05% NonZeroShifts/10/shrVU 16.5ns ± 0% 13.1ns ± 0% -20.12% NonZeroShifts/10/shlVU 16.8ns ± 1% 14.1ns ± 0% -16.02% NonZeroShifts/100/shrVU 122ns ± 0% 94ns ± 0% -22.87% NonZeroShifts/100/shlVU 115ns ± 0% 103ns ± 0% -10.50% NonZeroShifts/1000/shrVU 1.10µs ± 0% 0.91µs ± 0% -17.03% NonZeroShifts/1000/shlVU 1.02µs ± 0% 0.93µs ± 0% -8.74% NonZeroShifts/10000/shrVU 10.9µs ± 0% 9.1µs ± 0% -16.66% NonZeroShifts/10000/shlVU 10.1µs ± 0% 9.3µs ± 0% -8.19% NonZeroShifts/100000/shrVU 109µs ± 0% 91µs ± 0% -16.01% NonZeroShifts/100000/shlVU 101µs ± 0% 94µs ± 0% -7.16% Change-Id: Ia31951cc29a4169beb494d2951427cbe1e963b11 Reviewed-on: https://go-review.googlesource.com/c/go/+/384474 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-04-11all: gofmt main repoRuss Cox
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-04-05all: replace `` and '' with “ (U+201C) and ” (U+201D) in doc commentsRuss Cox
go/doc in all its forms applies this replacement when rendering the comments. We are considering formatting doc comments, including doing this replacement as part of the formatting. Apply it to our source files ahead of time. For #51082. Change-Id: Ifcc1f5861abb57c5d14e7d8c2102dfb31b7a3a19 Reviewed-on: https://go-review.googlesource.com/c/go/+/384262 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-04-05[dev.boringcrypto] all: merge master into dev.boringcryptoLasse Folger
Change-Id: Iaf618444dd2d99721c19708df9ce2c1f35854efd
2022-04-01all: remove trailing blank doc comment linesRuss Cox
A future change to gofmt will rewrite // Doc comment. // func f() to // Doc comment. func f() Apply that change preemptively to all doc comments. For #51082. Change-Id: I4023e16cfb0729b64a8590f071cd92f17343081d Reviewed-on: https://go-review.googlesource.com/c/go/+/384259 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01all: fix TODO comment hanging indentsRuss Cox
For whatever reason (perhaps some tool does this), a handful of comments, including some doc comments, have TODOs formatted like: // TODO(name): Text here and // more text aligned // under first text. In doc comments the second line turns into a <pre> block, which is undesirable in this context. Rewrite those to unindent, like this instead: // TODO(name): Text here and // more text aligned // at left column. For #51082. Change-Id: Ibf5145659a61ebf9496f016752a709a7656d2d4b Reviewed-on: https://go-review.googlesource.com/c/go/+/384258 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01all: fix various doc comment formatting nitsRuss Cox
A run of lines that are indented with any number of spaces or tabs format as a <pre> block. This commit fixes various doc comments that format badly according to that (standard) rule. For example, consider: // - List item. // Second line. // - Another item. Because the - lines are unindented, this is actually two paragraphs separated by a one-line <pre> block. This CL rewrites it to: // - List item. // Second line. // - Another item. Today, that will format as a single <pre> block. In a future release, we hope to format it as a bulleted list. Various other minor fixes as well, all in preparation for reformatting. For #51082. Change-Id: I95cf06040d4186830e571cd50148be3bf8daf189 Reviewed-on: https://go-review.googlesource.com/c/go/+/384257 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31math/big: call norm when returning success from Rat SetStringShulhan
After CL 24430, reflect.DeepEqual no longer returns true when comparing a *Rat built with (*Rat).SetString("0") with one built with (*Rat).SetInt64(0). These should be equivalent, but because (*Rat).SetString does not call norm() when returning the zero value, the result of reflect.DeepEqual will be false. One could suggest that developers should use (*Rat).Cmp instead of relying on reflect.DeepEqual, but if a (*Rat) is part of a larger struct that is being compared, this can be cumbersome. This is fixed by calling z.norm() when returning zero in SetString. Fixes #50944 Change-Id: Ib84ae975bf82fe02d1203aa9668a01960c0fd59d Reviewed-on: https://go-review.googlesource.com/c/go/+/364434 Reviewed-by: Katie Hockman <katie@golang.org> Trust: Katie Hockman <katie@golang.org> Trust: Ian Lance Taylor <iant@golang.org>
2022-03-29[dev.boringcrypto] all: merge master into dev.boringcryptoNicolas Hillegeer
Change-Id: I04d511ed8e3e7ca4a3267f226a0c3e248c0f84a9
2022-03-07[dev.boringcrypto] all: merge master into dev.boringcryptoDavid Chase
Change-Id: I4e09d4f2cc77c4c2dc12f1ff40d8c36053ab7ab6