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: Brad Gibbs <email@hidden>
- Date: Mon, 30 Nov 2009 12:32:34 -0800
I guess it is. I had another issue that was preventing the code from working properly. Another list member mailed me an explanation offline, causing me to look for and find the real problem preventing my code from running.
Thanks for the response.
On Nov 30, 2009, at 12:22 PM, Jens Alfke wrote:
>
> 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