On Oct 30, 2009, at 1:46 PM, Jens Alfke wrote: > On Oct 30, 2009, at 10:31 AM, Sean McBride wrote: > >> I don't get why for ints they have host<->big, host<->little, >> etc. for the floats they don't. Instead they have those weird host<- >>> >> swapped. And though they take floats, they return structs. > > I think this is to avoid storing swapped floats in 'float' variables. A > swapped int is a valid int, but a swapped float is often an invalid IEEE > floating-point value. My suspicion is that the CPU might mistreat such values > when they're read into FP registers, even if no arithmetic is done on them in > that state. (But that's just a suspicion; anyone know the gory details?)
This old thread seems to confirm your suspicion: http://www.omnigroup.com/mailman/archive/macosx-dev/2002-October/042692.html ...and IIRC this message was particularly useful in demonstrating how to use NSSwappedFloat: http://www.omnigroup.com/mailman/archive/macosx-dev/2002-October/042705.html
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
