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 (Cocoa-dev@lists.apple.com)
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 arch...@mail-archive.com