diff options
| author | Russ Cox <rsc@golang.org> | 2016-05-24 02:45:11 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2016-05-24 13:34:20 +0000 |
| commit | ab4414773e27624abf4361e48a0ca0979e804970 (patch) | |
| tree | 5cbf9727f6f776e3172c6b246f36120df19715b4 /src/encoding/json | |
| parent | 7a9f6c2b56bd87ff7f9296344c9e63cc46194428 (diff) | |
| download | go-ab4414773e27624abf4361e48a0ca0979e804970.tar.xz | |
math/big: write t*10 to multiply t by 10
The compiler has caught up.
In fact the compiler is ahead; it knows about a magic multiply-by-5 instruction:
// compute '0' + byte(r - t*10) in AX
MOVQ t, AX
LEAQ (AX)(AX*4), AX
SHLQ $1, AX
MOVQ r, CX
SUBQ AX, CX
LEAL 48(CX), AX
For comparison, the shifty version compiles to:
// compute '0' + byte(r - t*10) in AX
MOVQ t, AX
MOVQ AX, CX
SHLQ $3, AX
MOVQ r, DX
SUBQ AX, DX
SUBQ CX, DX
SUBQ CX, DX
LEAL 48(DX), AX
Fixes #2671.
Change-Id: Ifbf23dbfeb19c0bb020fa44eb2f025943969fb6b
Reviewed-on: https://go-review.googlesource.com/23372
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/encoding/json')
0 files changed, 0 insertions, 0 deletions
