Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ncar!hsdndev!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: which bits are set Message-ID: <3047:Dec1618:51:1590@kramden.acf.nyu.edu> Date: 16 Dec 90 18:51:15 GMT References: <1990Dec12.205114.2376@uvm.edu> Organization: IR Lines: 10 In article <1990Dec12.205114.2376@uvm.edu> hartley@emily.uvm.edu (Stephen J. Hartley) writes: > I have a related problem: determining the position > numbers of all the bits that are set in a 32-bit integer. The "brute force" > approach follows. Is there a faster (clever) way to do this in C? The brute force (i.e., fast) approach is to use a big table. Even better, represent sets of numbers as integers. ---Dan