[comp.arch] bit reversal instr/sw

chris@mimsy.UUCP (Chris Torek) (11/12/88)

In article <866@cernvax.UUCP> hjm@cernvax.UUCP (Hubert Matthews) writes:
>The INMOS T800 has an instruction bitrevword, which turns a
>little-endian word into a big-endian word, effectively doing a
>reflection in the middle. ... In software, it takes quite some time.
>In hardware it takes just over 1 microsecond on a 30MHz part.

The MIT X Window system library has to reverse the bits in a byte,
word, or longword.  It uses a 256-element table lookup, possibly
iterated (unrolled) for word and longword flips.  Expand the table
to 16 bits (65536 elements) and you can do it in 4 VAX instructions;
otherwise it takes 8.  Not so slow after all. . . .

(Of course, PCC does not manage to use 8 instructions, at least not
without much help.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris