Re: float from NSData
Re: float from NSData
- Subject: Re: float from NSData
- From: Ben Lachman <email@hidden>
- Date: Mon, 02 Mar 2009 21:50:22 -0500
Just to note. Depending on how many of these you're sending over the
link, I think having an NSData for every 4 byte float is a bit
overkill and could probably end up being a bottle neck. I'm not
saying you should optimize early, but there might be a more straight
forward way of creating a float out of the raw data than first shoving
it into a data then some other object and then finally outputting it
as a 32-bit float.
--
Ben Lachman
Acacia Tree Software
http://acaciatreesoftware.com
email: email@hidden
twitter: @benlachman
mobile: 740.590.0009
On Mar 2, 2009, at 8:32 PM, Jay Kickliter wrote:
I have a case where I'm sending IEEE 754 32-bit floats to my Cocoa
program over a wireless serial link, they are being sent MSB first.
I'm using AMSerialPort to handle my data, and after a little
parsing, I'm left with a 4 byte NSData, which has the 32-bit float
split into 4 bytes.
I know I have to play around to make sure the bytes are in the right
order. But what I can't seem to figure out, is how I create a float
from those 4 bytes stored in an instance of NSData. Has anybody run
into this situation?_______________________________________________
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
_______________________________________________
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