Re: Does NSData rearrange the order of bits?
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