Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!usc!srhqla!demott!kdq From: kdq@demott.COM (Kevin D. Quitt) Newsgroups: comp.lang.c Subject: Re: How to reverse bits... Message-ID: <487@demott.COM> Date: 13 Aug 90 23:09:53 GMT References: <1990Aug13.185757.3236@sti.fi> Reply-To: kdq@demott.COM (Root) Organization: DeMott Electronics Co., Van Nuys CA Lines: 8 In article <1990Aug13.185757.3236@sti.fi> ttl@sti.fi (Timo Lehtinen) writes: >This might be trivial, but here goes... >What's the most optimal way to reverse the bits in an unsigned char, >i.e. change from MSB to LSB ordering ? > If by optimal, you mean fastest with the least code, try a char[256] array with the bits already reversed. You just look 'em up. (It may be gross, but the table+code is often smaller than the conversion code).