Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(101)

Unified Diff: src/pkg/strconv/extfloat.go

Issue 7312068: many/packages: workarounds to avoid bugs in go/types ha... (Closed)
Patch Set: diff -r dd18b993ba95 https://code.google.com/p/go/ Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/strconv/atof.go ('k') | src/pkg/strconv/ftoa.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/strconv/extfloat.go
===================================================================
--- a/src/pkg/strconv/extfloat.go
+++ b/src/pkg/strconv/extfloat.go
@@ -139,13 +139,13 @@
// Extract 1+flt.mantbits bits from the 64-bit mantissa.
mant := f.mant >> (63 - flt.mantbits)
- if f.mant&(1<<(62-flt.mantbits)) != 0 {
+ if f.mant&uint64(1<<(62-flt.mantbits)) != 0 {
// Round up.
mant += 1
}
// Rounding might have added a bit; shift down.
- if mant == 2<<flt.mantbits {
+ if mant == uint64(2<<flt.mantbits) {
mant >>= 1
exp++
}
@@ -156,7 +156,7 @@
mant = 0
exp = 1<<flt.expbits - 1 + flt.bias
overflow = true
- } else if mant&(1<<flt.mantbits) == 0 {
+ } else if mant&uint64(1<<flt.mantbits) == 0 {
// Denormalized?
exp = flt.bias
}
@@ -164,7 +164,7 @@
bits = mant & (uint64(1)<<flt.mantbits - 1)
bits |= uint64((exp-flt.bias)&(1<<flt.expbits-1)) << flt.mantbits
if f.neg {
- bits |= 1 << (flt.mantbits + flt.expbits)
+ bits |= uint64(1 << (flt.mantbits + flt.expbits))
}
return
}
@@ -186,7 +186,7 @@
expBiased := exp - flt.bias
upper = extFloat{mant: 2*f.mant + 1, exp: f.exp - 1, neg: f.neg}
- if mant != 1<<flt.mantbits || expBiased == 1 {
+ if mant != uint64(1<<flt.mantbits) || expBiased == 1 {
lower = extFloat{mant: 2*f.mant - 1, exp: f.exp - 1, neg: f.neg}
} else {
lower = extFloat{mant: 4*f.mant - 1, exp: f.exp - 2, neg: f.neg}
@@ -317,7 +317,7 @@
}
halfway := uint64(1) << (extrabits - 1)
- mant_extra := f.mant & (1<<extrabits - 1)
+ mant_extra := f.mant & uint64(1<<extrabits-1)
// Do a signed comparison here! If the error estimate could make
// the mantissa round differently for the conversion to double,
@@ -443,7 +443,7 @@
for needed > 0 {
fraction *= 10
ε *= 10 // the uncertainty scales as we multiply by ten.
- if 2*ε > 1<<shift {
+ if 2*ε > uint64(1<<shift) {
// the error is so large it could modify which digit to write, abort.
return false
}
« no previous file with comments | « src/pkg/strconv/atof.go ('k') | src/pkg/strconv/ftoa.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b