Re: problem with [NSData bytes] on Intel
Re: problem with [NSData bytes] on Intel
- Subject: Re: problem with [NSData bytes] on Intel
- From: Doug Wyatt <email@hidden>
- Date: Sat, 4 Feb 2006 11:41:52 -0800
On Feb 4, 2006, at 5:17, Camillo Lugaresi wrote:
On 04/feb/06, at 11:06, Markus Hitter wrote:
Am 04.02.2006 um 10:57 schrieb Camillo Lugaresi:
On 04/feb/06, at 09:27, Markus Hitter wrote:
You miss handling the different endianess of both architectures?
For floats/doubles, both processors might even use a different
number of bits for mantissa and exponent.
No, they both use IEEE 754 floats.
This matters for the number of bits used but not for big/little
endian issues, right?
Right.
Er, I'm not sure I'm interpreting you correctly ... but it does sound
like John's problem could be endian-related.
If you have an NSData containing floats that came from an opposite-
endian processor, you have to swap them, e.g.
NSData *bigEndianFloats = ...;
const UInt32 *ptr = [bigEndianFloats bytes];
UInt32 temp = EndianU32_BtoN(ptr[0]);
Float32 firstFloat = *(Float32 *)&temp;
HTH,
Doug
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden