From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFseC-0004li-V2 for qemu-devel@nongnu.org; Wed, 13 Mar 2013 16:51:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFse8-00055u-QM for qemu-devel@nongnu.org; Wed, 13 Mar 2013 16:51:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57180) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFse8-00055q-Ic for qemu-devel@nongnu.org; Wed, 13 Mar 2013 16:51:36 -0400 Message-ID: <5140E6D4.3010600@redhat.com> Date: Wed, 13 Mar 2013 14:51:32 -0600 From: Eric Blake MIME-Version: 1.0 References: <1363144182-1016-1-git-send-email-jschopp@linux.vnet.ibm.com> <1363144182-1016-8-git-send-email-jschopp@linux.vnet.ibm.com> In-Reply-To: <1363144182-1016-8-git-send-email-jschopp@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2DUJPDRBFVHFFICTMWPUH" Subject: Re: [Qemu-devel] [PATCH 7/9] asn1_input-visitor.diff List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Joel Schopp Cc: Michael Tsirkin , qemu-devel@nongnu.org, Stefan Berger This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2DUJPDRBFVHFFICTMWPUH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/12/2013 09:09 PM, Joel Schopp wrote: > Implement an input visitor for ASN.1 BER encoding. >=20 > Cc: Michael Tsirkin > Signed-off-by: Stefan Berger > Signed-off-by: Joel Schopp > --- > include/qapi/ber-input-visitor.h | 30 ++ > qapi/Makefile.objs | 2 +- > qapi/ber-input-visitor.c | 1073 ++++++++++++++++++++++++++++++= ++++++++ > 3 files changed, 1104 insertions(+), 1 deletion(-) > create mode 100644 include/qapi/ber-input-visitor.h > create mode 100644 qapi/ber-input-visitor.c >=20 > diff --git a/include/qapi/ber-input-visitor.h b/include/qapi/ber-input-= visitor.h > new file mode 100644 > index 0000000..eaa3d0e > --- /dev/null > +++ b/include/qapi/ber-input-visitor.h > @@ -0,0 +1,30 @@ > +/* > + * BER Input Visitor header > + * > + * Copyright IBM, Corp. 2011 It's 2013 > +static void ber_input_type_number(Visitor *v, double *obj, const char = *name, > + Error **errp) > +{ > + BERInputVisitor *aiv =3D to_biv(v); > + uint32_t ber_type_tag; > + uint8_t ber_type_flags; > + uint32_t len; > + bool is_indefinite; > + char buf[128], buf2[128]; > + GDoubleIEEE754 num; > + struct ieee754_buffer number; > + size_t to_read; > + > + switch (number.first) { > + case 0x42: > + *obj =3D nan("NAN"); > + break; > + case 0x41: > + case 0x40: > + num.mpn.sign =3D ((number.first & 0x1) !=3D 0); > + num.mpn.biased_exponent =3D ~0; > + num.mpn.mantissa_low =3D 0; > + num.mpn.mantissa_high =3D 0; > + *obj =3D num.v_double; Is this really portable enough? In other words, do we really require that qemu only compiles on platforms where double is in IEEE format? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2DUJPDRBFVHFFICTMWPUH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRQObVAAoJEKeha0olJ0NquR8H/0CWo1xXS4OJqpIsbcwdzm3G dNeTFoL6S24QQdV6SV0376ylUnNLVVkfLjRFOIwcZ2ZLmJyxieZ9hoPHjBDr9Cad Mc3SQjOels/ht6v14qqNvzhWGrVc+zI9ME54/EnPr/PjSCu7GYMr3W+vdjrwTGkZ Y47fI8mO6feYmy89Dad65UghD+c+/ltYKyE11vuLZkchAAAoCboSe9oMvkoC+xGa yA6WbCRetrETbd755ASJD/bEql5Lydh5PSx7ZbO8Ih4BTEDhqNzKp9nEY3btX6mr jrXUTyePzez6VEvn4hAMZcVvKJ1NLfGNVCtR91BMTyDZJ5bekydcLVVcVBa9hkY= =yDXC -----END PGP SIGNATURE----- ------enig2DUJPDRBFVHFFICTMWPUH--