• 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: Does NSData rearrange the order of bits?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does NSData rearrange the order of bits?


  • Subject: Re: Does NSData rearrange the order of bits?
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 30 Nov 2009 12:22:49 -0800

On Nov 30, 2009, at 11:27 AM, Brad Gibbs wrote:

> I'm doing bit-packing via a C function.  Logging the bits of the C function shows the expected result.  If I create a string with a hex value format, I get the correct hex string, but, if I try to put the bytes into an NSData object with [NSData dataWithBytes: length], the order of the bits changes.  All of the right elements are there, but they're in the wrong order (target data should be f0000651, as shown in the Target string is ... log).
...
> 2009-11-30 11:02:26.126 CertTest[11959:a0f] Target data is <510600f0>.  Target string is f0000651

Isn't this the expected byte ordering for a little-endian CPU like x86? The least-significant byte of an integer appears first.

—Jens_______________________________________________

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: Does NSData rearrange the order of bits?
      • From: Brad Gibbs <email@hidden>
References: 
 >Does NSData rearrange the order of bits? (From: Brad Gibbs <email@hidden>)

  • Prev by Date: Behavior of CFStringUpper/Lowercase for NULL Locale?
  • Next by Date: Re: Does NSData rearrange the order of bits?
  • Previous by thread: Does NSData rearrange the order of bits?
  • Next by thread: Re: Does NSData rearrange the order of bits?
  • Index(es):
    • Date
    • Thread