Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: How to reverse bits... Message-ID: <1990Aug14.175900.23517@zoo.toronto.edu> Organization: U of Toronto Zoology References: <1990Aug13.185757.3236@sti.fi> Date: Tue, 14 Aug 90 17:59:00 GMT In article <1990Aug13.185757.3236@sti.fi> ttl@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@zoo.toronto.edu utzoo!henry