How to reverse bits...

Henry Spencer henry at zoo.toronto.edu
Wed Aug 15 03:59:00 AEST 1990


In article <1990Aug13.185757.3236 at sti.fi> ttl at sti.fi (Timo Lehtinen) writes:
>What's the most optimal way to reverse the bits in an unsigned char,
>i.e. change from MSB to LSB ordering ?

What do you mean by "optimal"?  Fastest?  Most compact?  On what machine?
Your question has no single answer as it stands.

Unless your chars have a ridiculous number of bits, as others have mentioned,
a lookup table is almost certainly quickest.
-- 
It is not possible to both understand  | Henry Spencer at U of Toronto Zoology
and appreciate Intel CPUs. -D.Wolfskill|  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.lang.c mailing list