On 9 Nov 2009, at 12:08, Graham Cox wrote:
On 09/11/2009, at 10:55 PM, Alastair Houghton wrote:
It's pretty easy to do a bit count on a fixed-size word (no need
for a loop, in fact).
There are some examples of how to do this here, including some
really, really clever methods. Is this what you had in mind Alastair?
http://gurmeetsingh.wordpress.com/2008/08/05/fast-bit-counting-routines/
Yes, those kinds of things.
Also, I neglected to point out that for binary and hexadecimal, it's
possible to do more than one digit at a time, even if you don't want
leading zeroes (for the non-leading-zeroes case, you just need two
tables of results, one with leading zeroes and one without, then the
first time you encounter a one bit, you swap from the no-leading-
zeroes table to the one with leading zeroes).
Anyway, there are lots of neat tricks of this nature.
(All of this probably isn't for newbie C programmers, though it's
perfectly possible that a newbie ObjC programmer might not be new to C
or C++.)
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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