Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.lang.c Subject: Re: reversing a mask Message-ID: <6055@brl-tgr.ARPA> Date: Sun, 25-Nov-84 14:46:11 EST Article-I.D.: brl-tgr.6055 Posted: Sun Nov 25 14:46:11 1984 Date-Received: Tue, 27-Nov-84 03:56:15 EST References: <1@imd.UUCP> <469@ncoast.UUCP> <691@gloria.UUCP> <4069@rochester.UUCP> Organization: Ballistic Research Lab Lines: 11 > >What's the fastest way to reverse a 16-bit mask in C? In 68000 asl? > > Actually the 65536 combination answer wasn't too far from a plausible > method - split the word up into 2 8 bit bytes and then do two lookups. > Then swap bytes. This way you only need one 256 byte table. > > You could do lookups on nybbles, etc, ad nauseum. Hey! Take this to the logical extreme: split into 16 1-bit fields, then you can dispense with the table altogether (since the reversal of a 1-bit field is itself). :-)