Commit a67292f2 authored by Rob Pike's avatar Rob Pike

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

R=rsc, gri, r2
CC=golang-dev
https://golang.org/cl/4169048
parent a93c994b
...@@ -64,7 +64,7 @@ func FtoaN(f float64, fmt byte, prec int, n int) string { ...@@ -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 { 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) exp := int(bits>>flt.mantbits) & (1<<flt.expbits - 1)
mant := bits & (uint64(1)<<flt.mantbits - 1) mant := bits & (uint64(1)<<flt.mantbits - 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment