• 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: "byte orders" question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "byte orders" question


  • Subject: Re: "byte orders" question
  • From: Charles Srstka <email@hidden>
  • Date: Sat, 26 Nov 2011 17:55:02 -0600

On Nov 26, 2011, at 5:44 PM, Koen van der Drift wrote:

>> At any rate, HostToBig is not what you want in the client, since you’re swapping it *to* the host byte order, not *from* it. CFSwapInt32BigToHost() would be more correct in that case, even though the two functions will both do the same thing in practice on a little-endian machine.
>
> Thanks for pointing that. They indeed give the same result.

Another thing that might be a good idea for general safety reasons is to have f be a Float32 instead of a regular float type. Although I don’t know how likely it is, it’s probably theoretically possible that the float data type could eventually become something other than 32 bits on some platform, and if that happened, doing a memcpy of sizeof(float) bytes from a uint32_t would cause garbage data to be written to the float.

Charles_______________________________________________

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

  • Follow-Ups:
    • Re: "byte orders" question
      • From: Koen van der Drift <email@hidden>
    • Re: "byte orders" question
      • From: Andreas Grosam <email@hidden>
References: 
 >"byte orders" question (From: Koen van der Drift <email@hidden>)
 >Re: "byte orders" question (From: Ben Kennedy <email@hidden>)
 >Re: "byte orders" question (From: Koen van der Drift <email@hidden>)
 >Re: "byte orders" question (From: Scott Ribe <email@hidden>)
 >Re: "byte orders" question (From: Koen van der Drift <email@hidden>)
 >Re: "byte orders" question (From: "Glenn L. Austin" <email@hidden>)
 >Re: "byte orders" question (From: Koen van der Drift <email@hidden>)
 >Re: "byte orders" question (From: Scott Ribe <email@hidden>)
 >Re: "byte orders" question (From: Koen van der Drift <email@hidden>)
 >Re: "byte orders" question (From: Koen van der Drift <email@hidden>)
 >Re: "byte orders" question (From: Charles Srstka <email@hidden>)
 >Re: "byte orders" question (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: "byte orders" question
  • Next by Date: Re: "byte orders" question
  • Previous by thread: Re: "byte orders" question
  • Next by thread: Re: "byte orders" question
  • Index(es):
    • Date
    • Thread