diff --git a/msgpack_reader.go b/msgpack_reader.go index 7d1a88f..33ac95b 100644 --- a/msgpack_reader.go +++ b/msgpack_reader.go @@ -255,6 +255,21 @@ func decodeBool(dec *msgpack.Decoder, v *bool) error { } func decodeFloat32(dec *msgpack.Decoder, v *float32) error { + code, err := dec.PeekCode() + if err != nil { + return errors.WithStack(err) + } + + if code == msgpcode.Double { + var tmp float64 + if err := decodeFloat64(dec, &tmp); err != nil { + return err + } + + *v = float32(tmp) + return nil + } + tmp, err := dec.DecodeFloat32() if err != nil { return errors.WithStack(err)