Re: Hex to NSString or NSData
Re: Hex to NSString or NSData
- Subject: Re: Hex to NSString or NSData
- From: Andrew Farmer <email@hidden>
- Date: Sat, 9 May 2009 20:15:20 -0700
On 09 May 09, at 18:58, Gwynne Raskind wrote:
c = hexCharToNibble(i % 255);
May want to use the & operator instead of %. IIRC, modulus needs
integer division, and may be taking more time than the inlined
hexCharToNibble.
Yeah, but since that was only done as part of a benchmark, it didn't
much matter. It may have skewed the numbers upwards unnecessarily,
but wouldn't have changed their relation to each other since the
same sequence was calculated for all three versions.
It's irrelevant, though, because i % 255 is wrong. It should be i %
256, which the compiler will optimize to i & 255 (which is much faster).
_______________________________________________
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