Re: "byte orders" question
Re: "byte orders" question
- Subject: Re: "byte orders" question
- From: Charles Srstka <email@hidden>
- Date: Mon, 28 Nov 2011 03:38:00 -0600
On Nov 28, 2011, at 2:41 AM, Andreas Grosam wrote:
> On Nov 27, 2011, at 12:55 AM, Charles Srstka wrote:
>
>> On Nov 26, 2011, at 5:44 PM, Koen van der Drift wrote:
>>
>> Another thing that might be a good idea for general safety reasons is to have f be a Float32 instead of a regular float type.
>
> This will only work if we can safely assume the sender is using 4 byte floats. This cannot be guaranteed, since the size of floats is platform dependend. So, *if possible* I would recommend to send these floats as decimal strings and then convert these number strings to whatever math type appropriate on the receiver site. There is no base64 encoding/decoding required, too.
>
> Since the posted code is obviously not designed to be efficient, the extra cost for string to double/float conversions can probably be accepted or can even be compensated by a more efficient math type on the receiver site when performing computations.
He said that the sender isn’t his own code and isn’t something he can change, and that it is apparently sending raw binary data (in Base64 encoding). If you’re sending raw binary data, you’d *better* define the widths of your fields as part of the specification.
Charles_______________________________________________
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