• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSData encode decode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >NSData encode decode (From: James Maxwell <email@hidden>)
 >Re: NSData encode decode (From: James Maxwell <email@hidden>)
 >Re: NSData encode decode (From: Michael Ash <email@hidden>)

  • Prev by Date: Re: Toll-free bridge type at runtime
  • Next by Date: Re: Toll-free bridge type at runtime
  • Previous by thread: Re: NSData encode decode
  • Next by thread: Loading a view controller from a tab bar controller
  • Index(es):
    • Date
    • Thread