aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-02-11 16:06:04 -0800
committerRob Pike <r@golang.org>2011-02-11 16:06:04 -0800
commita67292f20f5248f6a189622c9d0e858942659789 (patch)
tree782a7234d6cbd36932e2ab594f367eba56b26846
parenta93c994bcf4c3ca75a25f2703ab7a66d9a84c4e3 (diff)
downloadgo-a67292f20f5248f6a189622c9d0e858942659789.tar.gz
go-a67292f20f5248f6a189622c9d0e858942659789.zip
strconv/ftoa: avoid a double shift. (shifts by variables are expensive.)
R=rsc, gri, r2 CC=golang-dev https://golang.org/cl/4169048
-rw-r--r--src/pkg/strconv/ftoa.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/strconv/ftoa.go b/src/pkg/strconv/ftoa.go
index 4ec3cdbb97..b6049c5458 100644
--- a/src/pkg/strconv/ftoa.go
+++ b/src/pkg/strconv/ftoa.go
@@ -64,7 +64,7 @@ func FtoaN(f float64, fmt byte, prec int, n int) string {
}
func genericFtoa(bits uint64, fmt byte, prec int, flt *floatInfo) string {
- neg := bits>>flt.expbits>>flt.mantbits != 0
+ neg := bits>>(flt.expbits+flt.mantbits) != 0
exp := int(bits>>flt.mantbits) & (1<<flt.expbits - 1)
mant := bits & (uint64(1)<<flt.mantbits - 1)