How to reverse bits...
Steve Resnick
stever at Octopus.COM
Thu Aug 16 03:59:34 AEST 1990
In article <1990Aug14.233308.27889 at caen.engin.umich.edu> jal at acc (John Lauro) writes:
>In article <1990Aug14.203212.16248 at motcad.portal.com> 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: (assuming 8 bit char c)
> c=255-c; or
> c^=255;
>
Why not use: ~c? on most machines I expect it would save CPU cycles as
well as instructions.
Cheers!
Steve
--
----------------------------------------------------------------------------
steve.resnick at f105.n143.z1@FIDONET.ORG #include<std_disclaimer.h>
Flames, grammar errors, spelling errrors >/dev/nul
----------------------------------------------------------------------------
More information about the Comp.lang.c
mailing list