mirror of
https://github.com/golang/go
synced 2024-11-25 05:57:57 -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:
parent
a93c994bcf
commit
a67292f20f
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user