Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!srhqla!demott!kdq From: kdq@demott.COM (Kevin D. Quitt) Newsgroups: comp.lang.c Subject: Re: How to reverse bits... Message-ID: <493@demott.COM> Date: 14 Aug 90 17:41:15 GMT References: <1990Aug14.124259.13475@sun.soe.clarkson.edu> Reply-To: kdq@demott.COM (Kevin D. Quitt) Distribution: usa Organization: DeMott Electronics Co., Van Nuys CA Lines: 32 In article <1990Aug14.124259.13475@sun.soe.clarkson.edu> gld2@clutx.clarkson.edu (E.W.D, ,0,0) writes: >From article <487@demott.COM>, by kdq@demott.COM (Kevin D. Quitt): >> 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). > > >Didn't this go around a while back? > >Having actually tried tables we found that >the best technique we found was to swap half >words, then half half words, ... down to >adjacent bits (at least on VAX, Sun 3, and a >few others). This resulted in the most dramatic >cooling of one of the hottest hot spots I've seen. Very interesting, I'm sure, but what does this have to do with the original request? He wanted to know how to reverse a single byte. -- _ Kevin D. Quitt demott!kdq kdq@demott.com DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266 VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last 96.37% of all statistics are made up.