qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 09/36] vmstate: introduce float32 arrays


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH 09/36] vmstate: introduce float32 arrays
Date: Tue, 20 Mar 2012 16:20:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux)

Peter Maydell <address@hidden> wrote:
> On 19 March 2012 22:57, Juan Quintela <address@hidden> wrote:
>> +/* 32 bit float */
>> +
>> +typedef union {
>> +    float32 f;
>> +    uint32_t i;
>> +} VMStateFloat32;
>> +
>> +static int get_float32(QEMUFile *f, void *pv, size_t size)
>> +{
>> +    float32 *v = pv;
>> +    VMStateFloat32 u;
>> +    qemu_get_be32s(f, &u.i);
>> +    *v = u.f;
>> +    return 0;
>> +}
>> +
>> +static void put_float32(QEMUFile *f, void *pv, size_t size)
>> +{
>> +    float32 *v = pv;
>> +    VMStateFloat32 u;
>> +    u.f = *v;
>> +    qemu_put_be32s(f, &u.i);
>> +}
>
> This conversion (float32<->uint32_t) should be done via
> float32_val() and make_float32().

you are right. we can even simplify things with this.  Thanks.



reply via email to

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