How to reverse bits...

Kevin D. Quitt kdq at demott.COM
Wed Aug 15 03:41:15 AEST 1990


In article <1990Aug14.124259.13475 at sun.soe.clarkson.edu> gld2 at clutx.clarkson.edu (E.W.D, ,0,0) writes:
>From article <487 at demott.COM>, by kdq at demott.COM (Kevin D. Quitt):
>> In article <1990Aug13.185757.3236 at sti.fi> ttl at 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 at 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.



More information about the Comp.lang.c mailing list