From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:32978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQHBy-0006Ro-Q8 for qemu-devel@nongnu.org; Fri, 04 May 2012 08:01:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQHBd-0005sg-Au for qemu-devel@nongnu.org; Fri, 04 May 2012 08:00:58 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57634 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQHBc-0005rk-VW for qemu-devel@nongnu.org; Fri, 04 May 2012 08:00:37 -0400 Message-ID: <4FA3C4E3.4000108@suse.de> Date: Fri, 04 May 2012 14:00:35 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 08/35] vmstate: introduce float32 arrays List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org Am 04.05.2012 12:54, schrieb Juan Quintela: > Signed-off-by: Juan Quintela > --- > savevm.c | 25 +++++++++++++++++++++++++ > vmstate.h | 5 +++++ > 2 files changed, 30 insertions(+), 0 deletions(-) >=20 > diff --git a/savevm.c b/savevm.c > index 2d18bab..a22278e 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -1082,6 +1082,31 @@ const VMStateInfo vmstate_info_uint16_equal =3D = { > .put =3D put_uint16, > }; >=20 > +/* 32 bit float */ > + > +static int get_float32(QEMUFile *f, void *pv, size_t size) > +{ > + float32 *v =3D pv; > + uint32_t u; > + qemu_get_be32s(f, &u); > + *v =3D make_float32(u); > + return 0; > +} > + > +static void put_float32(QEMUFile *f, void *pv, size_t size) > +{ > + float32 *v =3D pv; > + uint32_t u; > + u =3D float32_val(*v); > + qemu_put_be32s(f, &u); > +} > + > +const VMStateInfo vmstate_info_float32 =3D { > + .name =3D "float32", > + .get =3D get_float32, > + .put =3D put_float32, > +}; > + > /* timers */ >=20 > static int get_timer(QEMUFile *f, void *pv, size_t size) > diff --git a/vmstate.h b/vmstate.h > index 1a4a60b..135c5aa 100644 > --- a/vmstate.h > +++ b/vmstate.h > @@ -130,6 +130,8 @@ extern const VMStateInfo vmstate_info_uint16; > extern const VMStateInfo vmstate_info_uint32; > extern const VMStateInfo vmstate_info_uint64; >=20 > +extern const VMStateInfo vmstate_info_float32; > + > extern const VMStateInfo vmstate_info_timer; > extern const VMStateInfo vmstate_info_buffer; > extern const VMStateInfo vmstate_info_unused_buffer; > @@ -559,6 +561,9 @@ extern const VMStateDescription vmstate_cpu; > #define VMSTATE_INT64_ARRAY(_f, _s, _n) = \ > VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0) >=20 > +#define VMSTATE_FLOAT32_ARRAY(_f, _s, _n) = \ > + VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float32, float32) Why isn't there a VMSTATE_FLOAT32_ARRAY_V for symmetry? Otherwise looks fine. /-F > + > #define VMSTATE_BUFFER_V(_f, _s, _v) = \ > VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s,= _f))) >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg