On 03/12/2013 09:09 PM, Joel Schopp wrote: > Implement an input visitor for ASN.1 BER encoding. > > Cc: Michael Tsirkin <m...@redhat.com> > Signed-off-by: Stefan Berger <stef...@linux.vnet.ibm.com> > Signed-off-by: Joel Schopp <jsch...@linux.vnet.ibm.com> > --- > 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? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature