On 9 Nov 2009, at 16:42, Thomas Wetmore wrote:
These functions return how many one bits there are in a number, not
how many bit positions are needed to represent the number as a bit-
string with no leading zeros. They are fun but have no utility in
solving the OP's question.
Not true. Consider:
// Assumes n is 32-bits
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
bits = count_bits (n);
Anyway, while neat, bit twiddling isn't really a subject for
beginners, so to that extent I agree with you.
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