On Tue, 25 Aug 2009, Erik Hofman wrote:

>
>
> Tim Moore wrote:
>> The worst thing about that line is that it is broken :)
>
> I can't find anything about it that makes it 'broken', knowing that
> doubles are 64-bit and floats are 32-bit. It might be a bit better this
> way though.

The line:
   *((float*)&buf[length]) = sg_bswap_32(*(uint32_t*)&val);

Unless I'm mistaken the line writes a uint_32 (supposedly containing a 
byte-swapped float) to a float location, triggering a automatic value 
conversion from uint32 to float. Hmm.. and in addition to that val is a 
double so I would worry that *(uint32_t*)&val in fact only gives you the 
uint32_t value of the first half of the double. Time to fetch the C LRM.

Thanks to Tim for noticing this.

Cheers,

Anders
-- 
---------------------------------------------------------------------------
Anders Gidenstam
WWW: http://www.gidenstam.org/FlightGear/

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to