1
0
mirror of https://github.com/golang/go synced 2024-11-21 20:24:50 -07:00

strconv/ftoa: avoid a double shift. (shifts by variables are expensive.)

R=rsc, gri, r2
CC=golang-dev
https://golang.org/cl/4169048
This commit is contained in:
Rob Pike 2011-02-11 16:06:04 -08:00
parent a93c994bcf
commit a67292f20f

View 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)