Re: NSData encode decode
Re: NSData encode decode
- Subject: Re: NSData encode decode
- From: Dave Geering <email@hidden>
- Date: Fri, 3 Apr 2009 13:38:34 +1100
>>
>> IEEE 754 floats always in the same order.
>>
>> p = 2.71828;
>> fprintf (stdout, "%x", *(unsigned long *)&p);
>>
>> Produces 402df84d on both my PPC and Intel Mac.
>
> Of course it does. Both long and float use the same byte order within
> the same CPU. That's all your test shows. Try doing this:
>
> float p = 2.71828;
> char *ptr = (char *)&p;
> printf("xxxx", ptr[0], ptr[1], ptr[2], ptr[3]);
>
> You will see reversed results between machines.
>
Of course! What was I thinking . . .
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden