This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Number of 1's in 64 bit number...[don't read if not interestedin algos/math...]


On Thu, 25 Apr 2002, Vivek Srivastava wrote:
>> Can any body give me the algo for finding number of 1's  (set bits) in a 64
>> bit number. Algo with out any loop or recurson.  Should be a reasonably
>> efficient and small and giving result in fixed time.
> I don't know why do you ask for an algo without any loops or recursion. As
> far as I can see, it cannot be done without them.

Of course you can!  Any problem with bounded input size can be trivially
implemented without loops or recursion (though code size will increase
with O(...)).

However, this kind of questions is *not* the scope of this mailing list
which is about developing GCC, not developing *with* GCC!

Gerald
-- 
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]