summaryrefslogtreecommitdiff
path: root/libgo/go/encoding/binary/binary.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/encoding/binary/binary.go')
-rw-r--r--libgo/go/encoding/binary/binary.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/libgo/go/encoding/binary/binary.go b/libgo/go/encoding/binary/binary.go
index ebc2ae8b7cf..77ff3a9f3ef 100644
--- a/libgo/go/encoding/binary/binary.go
+++ b/libgo/go/encoding/binary/binary.go
@@ -198,6 +198,10 @@ func sizeof(v reflect.Type) int {
return sum
case *reflect.UintType, *reflect.IntType, *reflect.FloatType, *reflect.ComplexType:
+ switch t := t.Kind(); t {
+ case reflect.Int, reflect.Uint, reflect.Uintptr:
+ return -1
+ }
return int(v.Size())
}
return -1
@@ -327,12 +331,12 @@ func (d *decoder) value(v reflect.Value) {
case *reflect.ComplexValue:
switch v.Type().Kind() {
case reflect.Complex64:
- v.Set(cmplx(
+ v.Set(complex(
float64(math.Float32frombits(d.uint32())),
float64(math.Float32frombits(d.uint32())),
))
case reflect.Complex128:
- v.Set(cmplx(
+ v.Set(complex(
math.Float64frombits(d.uint64()),
math.Float64frombits(d.uint64()),
))