From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFt6w-0007ca-PU for qemu-devel@nongnu.org; Wed, 13 Mar 2013 17:21:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFt6s-0006ST-Un for qemu-devel@nongnu.org; Wed, 13 Mar 2013 17:21:22 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:45202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFt6s-0006S8-R4 for qemu-devel@nongnu.org; Wed, 13 Mar 2013 17:21:18 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Mar 2013 17:21:17 -0400 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id AED2338C8054 for ; Wed, 13 Mar 2013 17:21:14 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2DLLEKh316682 for ; Wed, 13 Mar 2013 17:21:14 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2DLLDcT021858 for ; Wed, 13 Mar 2013 18:21:14 -0300 Message-ID: <5140EDB2.2090009@linux.vnet.ibm.com> Date: Wed, 13 Mar 2013 17:20:50 -0400 From: Stefan Berger 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> <5140E6D4.3010600@redhat.com> In-Reply-To: <5140E6D4.3010600@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 7/9] asn1_input-visitor.diff List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Joel Schopp , qemu-devel@nongnu.org, Michael Tsirkin On 03/13/2013 04:51 PM, Eric Blake wrote: > On 03/12/2013 09:09 PM, Joel Schopp wrote: >> Implement an input visitor for ASN.1 BER encoding. >> >> 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 >> >> 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 = 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 = nan("NAN"); >> + break; >> + case 0x41: >> + case 0x40: >> + num.mpn.sign = ((number.first & 0x1) != 0); >> + num.mpn.biased_exponent = ~0; >> + num.mpn.mantissa_low = 0; >> + num.mpn.mantissa_high = 0; >> + *obj = 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? > Good question. I don't know in what format the other platforms are, though. I know it's used on i386, x86_64, ppc, ppc64. My guess is that it would have to be a really exotic CPU to not use this standard. I hope this applies to ARM in general... http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0067d/Cihgejjg.html Regards, Stefan Stefan