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 interested in algos/math...]


On Thu, Apr 25, 2002 at 10:14:02AM +0530, Preeti Aira 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.

You can find such an algorithm in at least two places in the gcc
sources, and also in glibc.  You should be able to find it reasonably
easily using grep.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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