• 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: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare


  • Subject: Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
  • From: Graham Cox <email@hidden>
  • Date: Tue, 27 Jan 2009 16:28:22 +1100


On 27 Jan 2009, at 4:17 pm, Adam Venturella wrote:

Thanks! I knew I was doing to many steps!

uint key = *(uint*)&buffer;


You will also need to consider byte-ordering if your app or the data could be used on different architectures. If for example your input data is known to be big-endian, you'll probably want to do this:


uint key = NSSwapBigIntToHost( *(uint*)&buffer );

--Graham


_______________________________________________

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: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare (From: Adam Venturella <email@hidden>)
 >Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare (From: Graham Cox <email@hidden>)
 >Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare (From: Adam Venturella <email@hidden>)

  • Prev by Date: Re: Core Data performance [Re: Knowing when a NSArrayController is ready]
  • Next by Date: Re: How to catch and log EXC_BAD_ACCESS?
  • Previous by thread: Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
  • Next by thread: Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
  • Index(es):
    • Date
    • Thread