Path: utzoo!attcan!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!hpda!hpcuhb!hpcilzb!hpcea!hpausla!jcl From: jcl@hpausla.HP.COM (Jeff Laing) Newsgroups: comp.lang.forth Subject: Re: Re: Re: Re: Assembly or .... (two-result functions) Message-ID: <2560002@hpausla.HP.COM> Date: 11 Dec 88 22:06:30 GMT References: <3459@geaclib.UUCP> Organization: HP Australian Software Operation Lines: 20 > applications. One example is an operation you need for a > fft program. There you have to reverse the bitorder of a word. > In assembly language there's a very elegant and fast solution : > ... code deleted ... > If you want to write the same program in a high-level language > you have to work with bit-masks and test operations, which > is (compared to the program above) very slow and complicated. Of course, if you want it to run FAST, you drop back to a nice high level language and do something like static int rev15[16] = { 0, 8, 2, 12, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15} flipped = ( ( rev15[(orig ) & 0x000F] << 24 ) | ( rev15[(orig>>8 ) & 0x000F] << 16 ) | ( rev15[(orig>>16) & 0x000F] << 8 ) | ( rev15[(orig>>24) & 0x000F] ) ) Not a loop in sight, and your compiler should be able to make all those ANDs, ORs and SHIFTS real quick as well ...