diff --git a/src/fmt/print.go b/src/fmt/print.go index b7d24a8c473..460712cfe98 100644 --- a/src/fmt/print.go +++ b/src/fmt/print.go @@ -578,11 +578,6 @@ func (p *pp) fmtPointer(value reflect.Value, verb rune) { } } -var ( - intBits = reflect.TypeOf(0).Bits() - uintptrBits = reflect.TypeOf(uintptr(0)).Bits() -) - func (p *pp) catchPanic(arg interface{}, verb rune) { if err := recover(); err != nil { // If it's a nil pointer, just say "". The likeliest causes are a diff --git a/src/fmt/scan.go b/src/fmt/scan.go index bf7c9acb8ec..08b0bf96a6e 100644 --- a/src/fmt/scan.go +++ b/src/fmt/scan.go @@ -915,9 +915,14 @@ func (s *ss) hexString() string { return string(s.buf) } -const floatVerbs = "beEfFgGv" +const ( + floatVerbs = "beEfFgGv" -const hugeWid = 1 << 30 + hugeWid = 1 << 30 + + intBits = 32 << (^uint(0) >> 63) + uintptrBits = 32 << (^uintptr(0) >> 63) +) // scanOne scans a single value, deriving the scanner from the type of the argument. func (s *ss) scanOne(verb rune, arg interface{}) {