In article <1992Aug11.194714.42114@news.th-darmstadt.de>, wallmann@backus.pu.informatik.th-darmstadt.de (Natuerlich!) writes:
[stuff deleted]
|> >Yeah, you can have versions optimised for each shift amount. The only thing is
|> ^^^^^^^^^^^^^^^^
|> Since tables are pretty much out of the question (you only have 24 address
|> space in a ST, you'd need 32) I don't see what you want to optimize "for
|> each shift amount" that's not either 0 or 8. Maybe I am just clueless though.
|>
Oops, I meant seperate routines rather than separate versions of the routine
that I posted. For example when shift=15 it may be faster to use another method
based on addition (but maybe not - I can't be bothered to work it out right now).
|> >I still reckon that rotating & cookie cutting beats other multibit shifting methods in the general case.
|> It's a nice method for sure. I (since I have memory to blow) always pre-shift
|> 'em.
You can also adapt this method for horizontal scrolling by arbitrary number of pixels. Of course if shift % 16 = 1,8 or 0 specialized methods will be faster.