Newsgroups: comp.lang.lisp,comp.lang.scheme,sci.crypt,sci.math.num-analysis,sci.math.symbolic,sci.math,comp.lang.c,comp.lang.c++
Path: cantaloupe.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!miner.usbm.gov!news.er.usgs.gov!news1.radix.net!in1.nntp.cais.net!newsgate.nytimes.com!newsfeeds.sol.net!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!howland.erols.net!ix.netcom.com!hbaker
From: hbaker@netcom.com (Henry Baker)
Subject: Re: Name for fcn to find first low-order '1' bit in integer
Content-Type: text/plain; charset=ISO-8859-1
Message-ID: <hbaker-0502970736380001@10.0.2.1>
Sender: hbaker@netcom7.netcom.com
Content-Transfer-Encoding: 8bit
Organization: nil
X-Newsreader: Yet Another NewsWatcher 2.2.0
References: <hbaker-0302971702490001@10.0.2.1> <5d6291$i2g@tools.bbnplanet.com> <hbaker-0302972122000001@10.0.2.1> <BBADGER.97Feb4220420@jade.ssd.hcsc.com>
Mime-Version: 1.0
Distribution: inet
Date: Wed, 5 Feb 1997 15:36:38 GMT
Lines: 13
Xref: glinda.oz.cs.cmu.edu comp.lang.lisp:25145 comp.lang.scheme:18448 sci.crypt:61675 sci.math.num-analysis:32958 sci.math.symbolic:25273 sci.math:183874 comp.lang.c:235023 comp.lang.c++:245724

In article <BBADGER.97Feb4220420@jade.ssd.hcsc.com>, bbadger@mail.ccur.com
wrote:

> If you're talking about fixed-length arithmetic, like C, I found that
> it sometimes help to return, not the INDEX of the first bit, but a MASK
> containing the first bit.  Then 
> #define LSOB(n) (((~(n))+1)&(n))        /* Least Significant One Bit */

Why is this better than

#define TWOS(n) ((-(n))&(n))

??
