How to reverse bits...

Christopher R Volpe volpe at underdog.crd.ge.com
Wed Aug 15 22:41:02 AEST 1990


In article <43975 at apple.Apple.COM>, austing at Apple.COM (Glenn L. Austin) writes:
|>jtc at motcad.portal.com (J.T. Conklin) writes:
|>>Another useful table is one that flips the bits 1-for-0,0-for-1.  This
|>>is useful for inverting an image.
|>
|>How about "c ^= (char) -1"?

Works only on twos-complement machines. 

How about " c = ~c "?? It seems that there is a special purpose operator
that does exactly and only what the question is asking, it ought to be
used, no? Otherwise, what's it (the ~ operator) there for?                
==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.lang.c mailing list