]> Cypherpunks repositories - gostls13.git/commitdiff
strconv/ftoa: avoid a double shift. (shifts by variables are expensive.)
authorRob Pike <r@golang.org>
Sat, 12 Feb 2011 00:06:04 +0000 (16:06 -0800)
committerRob Pike <r@golang.org>
Sat, 12 Feb 2011 00:06:04 +0000 (16:06 -0800)
R=rsc, gri, r2
CC=golang-dev
https://golang.org/cl/4169048

src/pkg/strconv/ftoa.go

index 4ec3cdbb9743c3334c808e15287c9ddc762378b4..b6049c545899330847d96c02f15be8b456cb3124 100644 (file)
@@ -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)