Re: beginner question, NSNumber, NSDecimalAsNumber
Re: beginner question, NSNumber, NSDecimalAsNumber
- Subject: Re: beginner question, NSNumber, NSDecimalAsNumber
- From: Alastair Houghton <email@hidden>
- Date: Mon, 9 Nov 2009 17:25:55 +0000
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 (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
References: | |
| >beginner question, NSNumber, NSDecimalAsNumber (From: Jay Swartzfeger <email@hidden>) |
| >Re: beginner question, NSNumber, NSDecimalAsNumber (From: Ron Fleckner <email@hidden>) |
| >Re: beginner question, NSNumber, NSDecimalAsNumber (From: Graham Cox <email@hidden>) |
| >Re: beginner question, NSNumber, NSDecimalAsNumber (From: Thomas Wetmore <email@hidden>) |
| >Re: beginner question, NSNumber, NSDecimalAsNumber (From: Alastair Houghton <email@hidden>) |
| >Re: beginner question, NSNumber, NSDecimalAsNumber (From: Graham Cox <email@hidden>) |
| >Re: beginner question, NSNumber, NSDecimalAsNumber (From: Alastair Houghton <email@hidden>) |
| >Re: beginner question, NSNumber, NSDecimalAsNumber (From: Thomas Wetmore <email@hidden>) |