Path: utzoo!attcan!uunet!snorkelwacker!apple!vsi1!octopus!stever From: stever@Octopus.COM (Steve Resnick ) Newsgroups: comp.lang.c Subject: Re: How to reverse bits... Message-ID: <1990Aug15.175934.7693@Octopus.COM> Date: 15 Aug 90 17:59:34 GMT References: <2059@ux.acs.umn.edu> <1990Aug14.203212.16248@motcad.portal.com> <1990Aug14.233308.27889@caen.engin.umich.edu> Reply-To: steve.resnick@f105n143z1.FIDONET.ORG Organization: Octopus Enterprises, Cupertino CA Lines: 21 In article <1990Aug14.233308.27889@caen.engin.umich.edu> jal@acc (John Lauro) writes: >In article <1990Aug14.203212.16248@motcad.portal.com> jtc@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@f105.n143.z1@FIDONET.ORG #include Flames, grammar errors, spelling errrors >/dev/nul ----------------------------------------------------------------------------