qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 7/9] asn1_input-visitor.diff


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 7/9] asn1_input-visitor.diff
Date: Wed, 13 Mar 2013 14:51:32 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130219 Thunderbird/17.0.3

On 03/12/2013 09:09 PM, Joel Schopp wrote:
> Implement an input visitor for ASN.1 BER encoding.
> 
> Cc: Michael Tsirkin <address@hidden>
> Signed-off-by: Stefan Berger <address@hidden>
> Signed-off-by: Joel Schopp <address@hidden>
> ---
>  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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]