Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ittc!fpb From: fpb@ittc.wec.com (Frank P. Bresz) Newsgroups: comp.lang.c Subject: Re: How to reverse bits... Message-ID: Date: 16 Aug 90 00:10:12 GMT References: <2059@ux.acs.umn.edu> <1990Aug14.203212.16248@motcad.portal.com> <1990Aug14.233308.27889@caen.engin.umich.edu> <464.26c93018@astro.pc.ab.com> Sender: news@ittc.wec.com Reply-To: fbresz@ittc.wec.com Organization: Westinghouse, ITTC, Pgh, PA. Lines: 22 In-reply-to: browns@astro.pc.ab.com's message of 15 Aug 90 16:20:56 GMT In article <464.26c93018@astro.pc.ab.com> browns@astro.pc.ab.com (Stan Brown, Oak Road Systems) writes: >Please, no magic numbers. You can use the bitwise-complement operator, ~ tilde >(pronounced, "squiggle"). > c = ~c >It works on any numeric type, and the result has the same type as the operand. >Typical application: to sset all the bits in n unsigned word: Great solution obviously but it is not (pronounced, "squiggle"). its pronounced tilda. -- +--------------------+ |fbresz@ittc.wec.com | My opinions are my own, I'm not paid |uunet!ittc!fbresz | enough to make an official statement |(412)733-6749 | +-----------------------------------+ |Fax: (412)733-6444 | | THIS SPACE FOR SALE!!! | +--------------------+ +-----------------------------------+