On Nov 26, 2011, at 6:17 PM, Koen van der Drift wrote:
> Now I need to figure out how to go from u_int_32 to float.
I think I figured it out:
for (NSInteger n = 0; n < 4; n++)
{
u_int32_t value;
[base64DecodedData getBytes:&value range:NSMakeRange(n*4,
sizeof(u_int32_t))];
u_int32_t res = CFSwapInt32HostToBig(value);
float f;
memcpy(&f, &res, sizeof(f));
NSLog(@"%f", f);
}
This gives the expected four float values.
Does this look ok, or did I overlook something?
Thanks,
- Koen._______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]