Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site elsie.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!umcp-cs!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.lang.c Subject: Re: reversing a mask Message-ID: <4082@elsie.UUCP> Date: Sat, 24-Nov-84 19:03:27 EST Article-I.D.: elsie.4082 Posted: Sat Nov 24 19:03:27 1984 Date-Received: Mon, 26-Nov-84 02:00:40 EST References: <1@imd.UUCP> <469@ncoast.UUCP> <691@gloria.UUCP> Organization: NIH-LEC, Bethesda, MD Lines: 24 [Usenet brand software--ask for it by name] > What's the fastest way to reverse a 16-bit mask in C? In 68000 asl? > (Maybe this should be in net.puzzle!) Nah. . .too easy: static int revtab[65536] = { 0x0000, 0x8000, 0x4000, 0xc000, /* . . .16,382 lines of code left out to keep net costs down. . . */ 0x3fff, 0xbfff, 0x7fff, 0xffff }; #define reverse(value) (revtab[(unsigned int) value]) . . .with suitable documentation about range and type of the parameter being the responsibility of the caller. :-) -- Mask is a Wrather Corporation trademark--as Clayton Moore knows all too well. -- ..decvax!seismo!elsie!ado (301) 496-5688 DEC, VAX and Elsie are Digital Equipment and Borden trademarks